Commit de3ef886 authored by Chris Molozian's avatar Chris Molozian
Browse files

Upgrade GRPC, GRPC-Gateway, Protobuf, PGX, and other dependencies.

parent 58beffe9
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -5,8 +5,13 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr

## [Unreleased]
### Added
- Periodically check database hostname for underlying address changes.
- Expose Nakama errors to the runtime.
- Allow creation of relayed matches with a name. Names will be mapped to match identifiers.
- Expose Nakama errors to the server runtime.
- The wallet ledger view in the Nakama Console now supports pagination.

### Changed
- Periodically check database hostname for underlying address changes more frequently.
- Upgrade GRPC, GRPC-Gateway, Protobuf, PGX, and other dependencies.

### Fixed
- Fix optimistic email imports when linking social profiles.
+62 −25
Original line number Diff line number Diff line
module github.com/heroiclabs/nakama/v3

go 1.16
go 1.17

require (
	github.com/blevesearch/bleve/v2 v2.0.3
	github.com/blevesearch/upsidedown_store_api v1.0.1
	github.com/dgrijalva/jwt-go v3.2.1-0.20200107013213-dc14462fd587+incompatible
	github.com/dop251/goja v0.0.0-20210406175830-1b11a6af686d
	github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a // indirect
	github.com/blugelabs/bluge v0.1.7
	github.com/blugelabs/query_string v0.2.0
	github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06
	github.com/gofrs/uuid v4.0.0+incompatible
	github.com/golang/protobuf v1.5.2 // indirect
	github.com/golang-jwt/jwt/v4 v4.1.0
	github.com/gorilla/handlers v1.5.1
	github.com/gorilla/mux v1.8.0
	github.com/gorilla/websocket v1.4.2
	github.com/grpc-ecosystem/grpc-gateway/v2 v2.3.0
	github.com/heroiclabs/nakama-common v1.19.1-0.20211028165853-d67f8b2631f6
	github.com/jackc/pgconn v1.8.1
	github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0
	github.com/heroiclabs/nakama-common v0.0.0-20211029002510-769d7938e21f
	github.com/jackc/pgconn v1.10.0
	github.com/jackc/pgerrcode v0.0.0-20201024163028-a0d42d470451
	github.com/jackc/pgtype v1.7.0
	github.com/jackc/pgx/v4 v4.11.0
	github.com/m3db/prometheus_client_golang v0.8.1 // indirect
	github.com/m3db/prometheus_client_model v0.1.0 // indirect
	github.com/m3db/prometheus_common v0.1.0 // indirect
	github.com/m3db/prometheus_procfs v0.8.1 // indirect
	github.com/jackc/pgtype v1.8.1
	github.com/jackc/pgx/v4 v4.13.0
	github.com/rubenv/sql-migrate v0.0.0-20210408115534-a32ed26c37ea
	github.com/steveyen/gtreap v0.1.0
	github.com/stretchr/testify v1.7.0
	github.com/tinylib/msgp v1.1.2 // indirect
	github.com/uber-go/tally v3.3.17+incompatible
	github.com/ziutek/mymysql v1.5.4 // indirect
	go.uber.org/atomic v1.7.0
	go.uber.org/zap v1.16.0
	golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf
	google.golang.org/genproto v0.0.0-20210224155714-063164c882e6
	google.golang.org/grpc v1.37.0
	github.com/uber-go/tally/v4 v4.0.1
	go.uber.org/atomic v1.9.0
	go.uber.org/zap v1.19.1
	golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
	google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83
	google.golang.org/grpc v1.41.0
	google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0
	google.golang.org/protobuf v1.27.1
	gopkg.in/natefinch/lumberjack.v2 v2.0.0-20190411184413-94d9e492cc53
	gopkg.in/yaml.v2 v2.4.0
)

require (
	github.com/RoaringBitmap/roaring v0.9.4 // indirect
	github.com/axiomhq/hyperloglog v0.0.0-20191112132149-a4c4c47bc57f // indirect
	github.com/beorn7/perks v1.0.1 // indirect
	github.com/bits-and-blooms/bitset v1.2.0 // indirect
	github.com/blevesearch/go-porterstemmer v1.0.3 // indirect
	github.com/blevesearch/mmap-go v1.0.3 // indirect
	github.com/blevesearch/segment v0.9.0 // indirect
	github.com/blevesearch/snowballstem v0.9.0 // indirect
	github.com/blevesearch/vellum v1.0.7 // indirect
	github.com/blugelabs/bluge_segment_api v0.2.0 // indirect
	github.com/blugelabs/ice v0.2.0 // indirect
	github.com/caio/go-tdigest v3.1.0+incompatible // indirect
	github.com/cespare/xxhash/v2 v2.1.1 // indirect
	github.com/davecgh/go-spew v1.1.1 // indirect
	github.com/dgryski/go-metro v0.0.0-20180109044635-280f6062b5bc // indirect
	github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect
	github.com/felixge/httpsnoop v1.0.1 // indirect
	github.com/ghodss/yaml v1.0.0 // indirect
	github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
	github.com/golang/glog v1.0.0 // indirect
	github.com/golang/protobuf v1.5.2 // indirect
	github.com/golang/snappy v0.0.1 // indirect
	github.com/jackc/chunkreader/v2 v2.0.1 // indirect
	github.com/jackc/pgio v1.0.0 // indirect
	github.com/jackc/pgpassfile v1.0.0 // indirect
	github.com/jackc/pgproto3/v2 v2.1.1 // indirect
	github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
	github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
	github.com/mschoch/smat v0.2.0 // indirect
	github.com/pkg/errors v0.9.1 // indirect
	github.com/pmezard/go-difflib v1.0.0 // indirect
	github.com/prometheus/client_golang v1.11.0 // indirect
	github.com/prometheus/client_model v0.2.0 // indirect
	github.com/prometheus/common v0.26.0 // indirect
	github.com/prometheus/procfs v0.6.0 // indirect
	github.com/twmb/murmur3 v1.1.6 // indirect
	github.com/ziutek/mymysql v1.5.4 // indirect
	go.uber.org/multierr v1.6.0 // indirect
	golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
	golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
	golang.org/x/text v0.3.7 // indirect
	gopkg.in/gorp.v1 v1.7.2 // indirect
	gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
+161 −325

File changed.

Preview size limit exceeded, changes collapsed.

gtreap_compact/iterator.go

deleted100644 → 0
+0 −152
Original line number Diff line number Diff line
//  Copyright (c) 2015 Couchbase, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// 		http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package gtreap provides an in-memory implementation of the
// KVStore interfaces using the gtreap balanced-binary treap,
// copy-on-write data structure.
package gtreap_compact

import (
	"bytes"
	"sync"

	"github.com/steveyen/gtreap"
)

type Iterator struct {
	t *gtreap.Treap

	m        sync.Mutex
	cancelCh chan struct{}
	nextCh   chan *Item
	curr     *Item
	currOk   bool

	prefix []byte
	start  []byte
	end    []byte
}

func (w *Iterator) Seek(k []byte) {
	if w.start != nil && bytes.Compare(k, w.start) < 0 {
		k = w.start
	}
	if w.prefix != nil && !bytes.HasPrefix(k, w.prefix) {
		if bytes.Compare(k, w.prefix) < 0 {
			k = w.prefix
		} else {
			var end []byte
			for i := len(w.prefix) - 1; i >= 0; i-- {
				c := w.prefix[i]
				if c < 0xff {
					end = make([]byte, i+1)
					copy(end, w.prefix)
					end[i] = c + 1
					break
				}
			}
			k = end
		}
	}
	w.restart(&Item{k: k})
}

func (w *Iterator) restart(start *Item) *Iterator {
	cancelCh := make(chan struct{})
	nextCh := make(chan *Item, 1)

	w.m.Lock()
	if w.cancelCh != nil {
		close(w.cancelCh)
	}
	w.cancelCh = cancelCh
	w.nextCh = nextCh
	w.curr = nil
	w.currOk = false
	w.m.Unlock()

	go func() {
		if start != nil {
			w.t.VisitAscend(start, func(itm gtreap.Item) bool {
				select {
				case <-cancelCh:
					return false
				case nextCh <- itm.(*Item):
					return true
				}
			})
		}
		close(nextCh)
	}()

	w.Next()

	return w
}

func (w *Iterator) Next() {
	w.m.Lock()
	nextCh := w.nextCh
	w.m.Unlock()
	w.curr, w.currOk = <-nextCh
}

func (w *Iterator) Current() ([]byte, []byte, bool) {
	w.m.Lock()
	defer w.m.Unlock()
	if !w.currOk || w.curr == nil {
		return nil, nil, false
	}
	if w.prefix != nil && !bytes.HasPrefix(w.curr.k, w.prefix) {
		return nil, nil, false
	} else if w.end != nil && bytes.Compare(w.curr.k, w.end) >= 0 {
		return nil, nil, false
	}
	return w.curr.k, w.curr.v, w.currOk
}

func (w *Iterator) Key() []byte {
	k, _, ok := w.Current()
	if !ok {
		return nil
	}
	return k
}

func (w *Iterator) Value() []byte {
	_, v, ok := w.Current()
	if !ok {
		return nil
	}
	return v
}

func (w *Iterator) Valid() bool {
	_, _, ok := w.Current()
	return ok
}

func (w *Iterator) Close() error {
	w.m.Lock()
	if w.cancelCh != nil {
		close(w.cancelCh)
	}
	w.cancelCh = nil
	w.nextCh = nil
	w.curr = nil
	w.currOk = false
	w.m.Unlock()

	return nil
}

gtreap_compact/store.go

deleted100644 → 0
+0 −118
Original line number Diff line number Diff line
//  Copyright (c) 2015 Couchbase, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// 		http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package gtreap provides an in-memory implementation of the
// KVStore interfaces using the gtreap balanced-binary treap,
// copy-on-write data structure.

package gtreap_compact

import (
	"bytes"
	"fmt"
	"os"
	"sync"

	"github.com/blevesearch/bleve/v2/registry"
	"github.com/blevesearch/upsidedown_store_api"
	"github.com/steveyen/gtreap"
)

const Name = "gtreap_compact"

type Store struct {
	m  sync.Mutex
	t  *gtreap.Treap
	mo store.MergeOperator
}

type Item struct {
	k []byte
	v []byte
}

func itemCompare(a, b interface{}) int {
	return bytes.Compare(a.(*Item).k, b.(*Item).k)
}

func New(mo store.MergeOperator, config map[string]interface{}) (store.KVStore, error) {
	path, ok := config["path"].(string)
	if !ok {
		return nil, fmt.Errorf("must specify path")
	}
	if path != "" {
		return nil, os.ErrInvalid
	}

	rv := Store{
		t:  gtreap.NewTreap(itemCompare),
		mo: mo,
	}
	return &rv, nil
}

func (s *Store) Close() error {
	return nil
}

func (s *Store) Reader() (store.KVReader, error) {
	s.m.Lock()
	t := s.t
	s.m.Unlock()
	return &Reader{t: t}, nil
}

func (s *Store) Writer() (store.KVWriter, error) {
	return &Writer{s: s}, nil
}

// Compact removes DictionaryTerm entries with a count of zero.
// This is a workaround for github issue #374.
// Code from https://github.com/blevesearch/bleve/pull/1317.
func (s *Store) Compact() (err error) {
	kvreader, err := s.Reader()
	if err != nil {
		return err
	}

	defer func() {
		if cerr := kvreader.Close(); err == nil && cerr != nil {
			err = cerr
		}
	}()

	prefix := []byte("d")

	s.m.Lock()
	defer s.m.Unlock()
	it := kvreader.PrefixIterator(prefix)
	defer func() {
		if cerr := it.Close(); err == nil && cerr != nil {
			err = cerr
		}
	}()

	for ; it.Valid(); it.Next() {
		k, v, _ := it.Current()
		if bytes.Equal(v, []byte{0}) {
			s.t = s.t.Delete(&Item{k: k})
		}
	}

	return
}

func init() {
	registry.RegisterKVStore(Name, New)
}
Loading