Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sesposito committed Oct 10, 2023
1 parent f061a56 commit 8fd4684
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 23 deletions.
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/gorilla/mux v1.8.0
github.com/gorilla/websocket v1.5.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0
github.com/heroiclabs/nakama-common v1.28.2-0.20231010141902-2a5051b58ac5
github.com/heroiclabs/nakama-common v1.28.2-0.20231010150216-b178843845fa
github.com/jackc/pgconn v1.14.0
github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa
github.com/jackc/pgtype v1.14.0
Expand Down Expand Up @@ -81,5 +81,3 @@ require (
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
)

replace github.com/heroiclabs/nakama-common => ../nakama-common
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/heroiclabs/nakama-common v1.28.2-0.20231010141902-2a5051b58ac5 h1:AbvTXur7NgDz6j9JLMgsVoW1ifJpR+/5F2W2omjdbL4=
github.com/heroiclabs/nakama-common v1.28.2-0.20231010141902-2a5051b58ac5/go.mod h1:Os8XeXGvHAap/p6M/8fQ3gle4eEXDGRQmoRNcPQTjXs=
github.com/heroiclabs/nakama-common v1.28.2-0.20231010150216-b178843845fa h1:2yXME7CoepD1WIV/iGpMOVmyhFxlTrM4dGTKBxqaLpw=
github.com/heroiclabs/nakama-common v1.28.2-0.20231010150216-b178843845fa/go.mod h1:Os8XeXGvHAap/p6M/8fQ3gle4eEXDGRQmoRNcPQTjXs=
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
Expand Down
4 changes: 2 additions & 2 deletions server/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ func NewConsoleLogger(output *os.File, verbose bool) *zap.Logger {
}

func NewDB(t *testing.T) *sql.DB {
db, err := sql.Open("pgx", "postgresql://root@127.0.0.1:26257/nakama?sslmode=disable")
//db, err := sql.Open("pgx", "postgresql://postgres@127.0.0.1:5432/nakama?sslmode=disable")
//db, err := sql.Open("pgx", "postgresql://root@127.0.0.1:26257/nakama?sslmode=disable")
db, err := sql.Open("pgx", "postgresql://postgres:postgres@127.0.0.1:5432/nakama?sslmode=disable")
if err != nil {
t.Fatal("Error connecting to database", err)
}
Expand Down
3 changes: 1 addition & 2 deletions server/storage_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"fmt"
"time"

"google.golang.org/protobuf/types/known/timestamppb"

"github.com/blugelabs/bluge"
"github.com/blugelabs/bluge/index"
"github.com/blugelabs/bluge/search"
Expand Down Expand Up @@ -228,6 +226,7 @@ func (si *LocalStorageIndex) List(ctx context.Context, callerID uuid.UUID, index
if query == "" {
query = "*"
}

parsedQuery, err := ParseQueryString(query)
if err != nil {
return nil, err
Expand Down
16 changes: 8 additions & 8 deletions server/storage_index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ func TestLocalStorageIndex_Write(t *testing.T) {
t.Fatal(err.Error())
}

entries, err := storageIdx.List(ctx, indexName1, "", maxEntries1) // Match all
entries, err := storageIdx.List(ctx, uuid.Nil, indexName1, "", maxEntries1) // Match all
if err != nil {
t.Fatal(err.Error())
}
assert.Len(t, entries.Objects, 2, "indexed results length was not 2")

entries, err = storageIdx.List(ctx, indexName2, "", maxEntries1) // Match all
entries, err = storageIdx.List(ctx, uuid.Nil, indexName2, "", maxEntries1) // Match all
if err != nil {
t.Fatal(err.Error())
}
Expand Down Expand Up @@ -172,7 +172,7 @@ func TestLocalStorageIndex_Write(t *testing.T) {
t.Fatal(err.Error())
}

entries, err := storageIdx.List(ctx, indexName1, "+value.three:3", maxEntries1)
entries, err := storageIdx.List(ctx, uuid.Nil, indexName1, "+value.three:3", maxEntries1)
if err != nil {
t.Fatal(err.Error())
}
Expand Down Expand Up @@ -275,7 +275,7 @@ func TestLocalStorageIndex_Write(t *testing.T) {
t.Fatal(err.Error())
}

entries, err := storageIdx.List(ctx, indexName2, "", maxEntries2)
entries, err := storageIdx.List(ctx, uuid.Nil, indexName2, "", maxEntries2)
if err != nil {
t.Fatal(err.Error())
}
Expand Down Expand Up @@ -371,7 +371,7 @@ func TestLocalStorageIndex_List(t *testing.T) {
t.Fatal(err.Error())
}

entries, err := storageIdx.List(ctx, indexName, "value.one:1 value.three:3", 10)
entries, err := storageIdx.List(ctx, uuid.Nil, indexName, "value.one:1 value.three:3", 10)
if err != nil {
t.Fatal(err.Error())
}
Expand Down Expand Up @@ -464,7 +464,7 @@ func TestLocalStorageIndex_List(t *testing.T) {
t.Fatal(err.Error())
}

entries, err := storageIdx.List(ctx, indexName, "value.one:1 value.three:3", 10)
entries, err := storageIdx.List(ctx, uuid.Nil, indexName, "value.one:1 value.three:3", 10)
if err != nil {
t.Fatal(err.Error())
}
Expand Down Expand Up @@ -540,7 +540,7 @@ func TestLocalStorageIndex_Delete(t *testing.T) {
t.Fatal(err.Error())
}

entries, err := storageIdx.List(ctx, indexName, "", 10)
entries, err := storageIdx.List(ctx, uuid.Nil, indexName, "", 10)
if err != nil {
t.Fatal(err.Error())
}
Expand All @@ -557,7 +557,7 @@ func TestLocalStorageIndex_Delete(t *testing.T) {
t.Fatal(err.Error())
}

entries, err = storageIdx.List(ctx, indexName, "", 10)
entries, err = storageIdx.List(ctx, uuid.Nil, indexName, "", 10)
if err != nil {
t.Fatal(err.Error())
}
Expand Down
7 changes: 1 addition & 6 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/internal/genopena
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options
github.com/grpc-ecosystem/grpc-gateway/v2/runtime
github.com/grpc-ecosystem/grpc-gateway/v2/utilities
<<<<<<< HEAD
# github.com/heroiclabs/nakama-common v1.28.2-0.20231010141902-2a5051b58ac5
=======
# github.com/heroiclabs/nakama-common v1.28.1 => ../nakama-common
>>>>>>> c0fb6089 (Add storage index support for index only listings.)
# github.com/heroiclabs/nakama-common v1.28.2-0.20231010150216-b178843845fa
## explicit; go 1.19
github.com/heroiclabs/nakama-common/api
github.com/heroiclabs/nakama-common/rtapi
Expand Down Expand Up @@ -439,4 +435,3 @@ gopkg.in/natefinch/lumberjack.v2
# gopkg.in/yaml.v3 v3.0.1
## explicit
gopkg.in/yaml.v3
# github.com/heroiclabs/nakama-common => ../nakama-common

0 comments on commit 8fd4684

Please sign in to comment.