From 8bcfd8df0aa314d5f3723750562ec7f6acf6d9f1 Mon Sep 17 00:00:00 2001 From: Tuan Pham Anh Date: Mon, 25 Jul 2022 02:14:43 +0700 Subject: [PATCH 01/26] merge https://github.com/notional-labs/tm-db/tree/mainline/pebble --- .github/workflows/gaia.yml | 58 +++++ backend_test.go | 1 - badger_db.go | 2 +- boltdb.go | 5 +- boltdb_batch.go | 1 + boltdb_iterator.go | 1 + boltdb_test.go | 1 + cleveldb.go | 1 + cleveldb_batch.go | 1 + cleveldb_iterator.go | 8 +- cleveldb_test.go | 5 +- db.go | 10 +- go.mod | 12 +- go.sum | 149 +++++++++++++ goleveldb_iterator.go | 7 +- makefile | 5 + pebble.go | 418 +++++++++++++++++++++++++++++++++++++ pebble_test.go | 50 +++++ prefixdb_iterator.go | 1 - rocksdb.go | 1 + rocksdb_batch.go | 1 + rocksdb_iterator.go | 8 +- rocksdb_test.go | 1 + 23 files changed, 724 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/gaia.yml create mode 100644 pebble.go create mode 100644 pebble_test.go diff --git a/.github/workflows/gaia.yml b/.github/workflows/gaia.yml new file mode 100644 index 000000000..b1c5ef517 --- /dev/null +++ b/.github/workflows/gaia.yml @@ -0,0 +1,58 @@ +# This workflow builds and pushes a new version of the build container image +# when the tools directory changes on master. Edit tools/Dockerfile. +# +# This workflow does not push a new image until it is merged, so tests that +# depend on changes in this image will not pass until this workflow succeeds. +# For that reason, changes here should be done in a separate PR in advance of +# work that depends on them. + +name: State Sync Gaia +on: + pull_request: + push: + + +jobs: + build: + runs-on: ubuntu-latest + container: ghcr.io/faddat/gaia + continue-on-error: true + env: + INTERVAL: 1000 + GAIAD_STATESYNC_ENABLE: true + GAIAD_P2P_MAX_NUM_OUTBOUND_PEERS: 200 + GAIAD_P2P_SEEDS: "bf8328b66dceb4987e5cd94430af66045e59899f@public-seed.cosmos.vitwit.com:26656,cfd785a4224c7940e9a10f6c1ab24c343e923bec@164.68.107.188:26656,d72b3011ed46d783e369fdf8ae2055b99a1e5074@173.249.50.25:26656,ba3bacc714817218562f743178228f23678b2873@public-seed-node.cosmoshub.certus.one:26656,3c7cad4154967a294b3ba1cc752e40e8779640ad@84.201.128.115:26656,366ac852255c3ac8de17e11ae9ec814b8c68bddb@51.15.94.196:26656" + GAIAD_STATESYNC_RPC_SERVERS: "https://cosmoshub.validator.network:443,https://cosmoshub.validator.network:443" + GOPATH: /go + + + + + strategy: + matrix: + database: [rocksdb, pebbledb, boltdb, badgerdb, goleveldb, cleveldb] + + steps: + - run: git config --global --add safe.directory /__w/tendermint/tm-db + - uses: actions/checkout@v3 + - name: state sync gaia with ${{ matrix.database }} + run: | + cd .. + git clone https://github.com/cosmos/gaia + cd gaia + go mod edit -replace github.com/tendermint/tm-db=../tm-db + go mod tidy + go install -ldflags '-w -s -X github.com/cosmos/cosmos-sdk/types.DBBackend=${{ matrix.database }}' -tags ${{ matrix.database }} ./... + export LATEST_HEIGHT=$(curl -s https://cosmoshub.validator.network/block | jq -r .result.block.header.height); + export BLOCK_HEIGHT=$(($LATEST_HEIGHT-$INTERVAL)) + export TRUST_HASH=$(curl -s "https://cosmoshub.validator.network/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash) + export GAIAD_STATESYNC_TRUST_HEIGHT=$BLOCK_HEIGHT + export GAIAD_STATESYNC_TRUST_HASH=$TRUST_HASH + export PATH=$PATH:/go/bin + echo "TRUST HEIGHT: $BLOCK_HEIGHT" + echo "TRUST HASH: $TRUST_HASH" + gaiad init gaia-matrix + cp /genesis.json ~/.gaia/config/genesis.json + gaiad start --x-crisis-skip-assert-invariants --db_backend ${{ matrix.database }} + + \ No newline at end of file diff --git a/backend_test.go b/backend_test.go index 63630beca..aecae4bf5 100644 --- a/backend_test.go +++ b/backend_test.go @@ -315,7 +315,6 @@ func testDBIterator(t *testing.T, backend BackendType) { ritr, err = db2.ReverseIterator(nil, nil) require.NoError(t, err) verifyIterator(t, ritr, nil, "reverse iterator with empty db") - } func verifyIterator(t *testing.T, itr Iterator, expected []int64, msg string) { diff --git a/badger_db.go b/badger_db.go index 193372abf..467ed3361 100644 --- a/badger_db.go +++ b/badger_db.go @@ -25,7 +25,7 @@ func NewBadgerDB(dbName, dir string) (*BadgerDB, error) { // the final directory to use for the database. path := filepath.Join(dir, dbName) - if err := os.MkdirAll(path, 0755); err != nil { + if err := os.MkdirAll(path, 0o755); err != nil { return nil, err } opts := badger.DefaultOptions(path) diff --git a/boltdb.go b/boltdb.go index 398c401a4..9cdd6e4d3 100644 --- a/boltdb.go +++ b/boltdb.go @@ -1,3 +1,4 @@ +//go:build boltdb // +build boltdb package db @@ -11,9 +12,7 @@ import ( "go.etcd.io/bbolt" ) -var ( - bucket = []byte("tm") -) +var bucket = []byte("tm") func init() { registerDBCreator(BoltDBBackend, func(name, dir string) (DB, error) { diff --git a/boltdb_batch.go b/boltdb_batch.go index 390bc309b..cd22c6741 100644 --- a/boltdb_batch.go +++ b/boltdb_batch.go @@ -1,3 +1,4 @@ +//go:build boltdb // +build boltdb package db diff --git a/boltdb_iterator.go b/boltdb_iterator.go index 74212c5ca..a62e2abb8 100644 --- a/boltdb_iterator.go +++ b/boltdb_iterator.go @@ -1,3 +1,4 @@ +//go:build boltdb // +build boltdb package db diff --git a/boltdb_test.go b/boltdb_test.go index 0fd12bbe2..e68c85b0d 100644 --- a/boltdb_test.go +++ b/boltdb_test.go @@ -1,3 +1,4 @@ +//go:build boltdb // +build boltdb package db diff --git a/cleveldb.go b/cleveldb.go index 377956deb..789673011 100644 --- a/cleveldb.go +++ b/cleveldb.go @@ -1,3 +1,4 @@ +//go:build cleveldb // +build cleveldb package db diff --git a/cleveldb_batch.go b/cleveldb_batch.go index 132a521cb..b77bd523d 100644 --- a/cleveldb_batch.go +++ b/cleveldb_batch.go @@ -1,3 +1,4 @@ +//go:build cleveldb // +build cleveldb package db diff --git a/cleveldb_iterator.go b/cleveldb_iterator.go index 04375d565..cf5ac1942 100644 --- a/cleveldb_iterator.go +++ b/cleveldb_iterator.go @@ -1,3 +1,4 @@ +//go:build cleveldb // +build cleveldb package db @@ -56,7 +57,6 @@ func (itr cLevelDBIterator) Domain() ([]byte, []byte) { // Valid implements Iterator. func (itr cLevelDBIterator) Valid() bool { - // Once invalid, forever invalid. if itr.isInvalid { return false @@ -75,9 +75,9 @@ func (itr cLevelDBIterator) Valid() bool { } // If key is end or past it, invalid. - var start = itr.start - var end = itr.end - var key = itr.source.Key() + start := itr.start + end := itr.end + key := itr.source.Key() if itr.isReverse { if start != nil && bytes.Compare(key, start) < 0 { itr.isInvalid = true diff --git a/cleveldb_test.go b/cleveldb_test.go index 61e2fb6ef..ff1cd736b 100644 --- a/cleveldb_test.go +++ b/cleveldb_test.go @@ -1,3 +1,4 @@ +//go:build cleveldb // +build cleveldb package db @@ -38,7 +39,7 @@ func BenchmarkRandomReadsWrites2(b *testing.B) { val := internal[idx] idxBytes := int642Bytes(int64(idx)) valBytes := int642Bytes(int64(val)) - //fmt.Printf("Set %X -> %X\n", idxBytes, valBytes) + // fmt.Printf("Set %X -> %X\n", idxBytes, valBytes) db.Set( idxBytes, valBytes, @@ -53,7 +54,7 @@ func BenchmarkRandomReadsWrites2(b *testing.B) { if err != nil { b.Error(err) } - //fmt.Printf("Get %X -> %X\n", idxBytes, valBytes) + // fmt.Printf("Get %X -> %X\n", idxBytes, valBytes) if val == 0 { if !bytes.Equal(valBytes, nil) { b.Errorf("Expected %v for %v, got %X", diff --git a/db.go b/db.go index ef573f17e..29fe98175 100644 --- a/db.go +++ b/db.go @@ -28,13 +28,19 @@ const ( // - may be faster is some use-cases (random reads - indexer) // - use boltdb build tag (go build -tags boltdb) BoltDBBackend BackendType = "boltdb" - // RocksDBBackend represents rocksdb (uses github.com/cosmos/gorocksdb) + // RocksDBBackend represents rocksdb (uses github.com/linxGnu/grocksdb) // - EXPERIMENTAL // - requires gcc // - use rocksdb build tag (go build -tags rocksdb) RocksDBBackend BackendType = "rocksdb" - + // BadgerDBBackend represents badgerdb (uses github.com/dgraph-io/badger) + // - EXPERIMENTAL + // - use badgerdb build tag (go build -tags badgerdb) BadgerDBBackend BackendType = "badgerdb" + // PebbleDBDBBackend represents pebble (uses github.com/cockroachdb/pebble) + // - EXPERIMENTAL + // - use pebble build tag (go build -tags pebbledb) + PebbleDBBackend BackendType = "pebbledb" ) type dbCreator func(name string, dir string) (DB, error) diff --git a/go.mod b/go.mod index 1f0dd8ab9..1e89c07cb 100644 --- a/go.mod +++ b/go.mod @@ -14,12 +14,19 @@ require ( google.golang.org/grpc v1.48.0 ) -require github.com/dgraph-io/badger/v3 v3.2103.2 +require github.com/cockroachdb/pebble v0.0.0-20220421143146-8decd08cdb9d require ( + github.com/DataDog/zstd v1.4.5 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.1.1 // indirect + github.com/cockroachdb/errors v1.8.1 // indirect + github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f // indirect + github.com/cockroachdb/redact v1.0.8 // indirect + github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 // indirect + github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dgraph-io/badger/v3 v3.2103.2 github.com/dgraph-io/ristretto v0.1.0 // indirect github.com/dustin/go-humanize v1.0.0 // indirect github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect @@ -27,9 +34,12 @@ require ( github.com/golang/snappy v0.0.3 // indirect github.com/google/flatbuffers v1.12.1 // indirect github.com/klauspost/compress v1.12.3 // indirect + github.com/kr/pretty v0.1.0 // indirect + github.com/kr/text v0.1.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opencensus.io v0.22.5 // indirect + golang.org/x/exp v0.0.0-20200513190911-00229845015e // indirect golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 // indirect golang.org/x/text v0.3.3 // indirect diff --git a/go.sum b/go.sum index 0d1afaab2..456b17c71 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,22 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/CloudyKit/fastprinter v0.0.0-20170127035650-74b38d55f37a/go.mod h1:EFZQ978U7x8IRnstaskI3IysnWY5Ao3QgZUKOXlsAdw= +github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible/go.mod h1:HPYO+50pSWkPoj9Q/eq0aRGByCL6ScRlUmiEX5Zgm+w= +github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= +github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= +github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7/go.mod h1:6E6s8o2AE4KhCrqr6GRJjdC/gNfTdxkIXvuGZZda2VM= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= +github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -17,6 +29,21 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/datadriven v1.0.0/go.mod h1:5Ib8Meh+jk1RlHIXej6Pzevx/NLlNvQB9pmSBZErGA4= +github.com/cockroachdb/errors v1.6.1/go.mod h1:tm6FTP5G81vwJ5lC0SizQo374JNCOPrHyXGitRJoDqM= +github.com/cockroachdb/errors v1.8.1 h1:A5+txlVZfOqFBDa4mGz2bUWSp0aHElvHX2bKkdbQu+Y= +github.com/cockroachdb/errors v1.8.1/go.mod h1:qGwQn6JmZ+oMjuLwjWzUNqblqk0xl4CVV3SQbGwK7Ac= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= +github.com/cockroachdb/pebble v0.0.0-20220421143146-8decd08cdb9d h1:rMLrmABNLB5RPEvy/lynjDL1EyCCXpcjBtCgt4D9DTs= +github.com/cockroachdb/pebble v0.0.0-20220421143146-8decd08cdb9d/go.mod h1:buxOO9GBtOcq1DiXDpIPYrmxY020K2A8lOrwno5FetU= +github.com/cockroachdb/redact v1.0.8 h1:8QG/764wK+vmEYoOlfobpe12EQcS81ukx/a4hdVMxNw= +github.com/cockroachdb/redact v1.0.8/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= +github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -26,32 +53,56 @@ github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwc github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgraph-io/badger v1.6.0 h1:DshxFxZWXUcO0xX476VJC07Xsr6ZCBVRHKZ93Oh7Evo= +github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgraph-io/badger/v3 v3.2103.2 h1:dpyM5eCJAtQCBcMCZcT4UBZchuTJgCywerHHgmxfxM8= github.com/dgraph-io/badger/v3 v3.2103.2/go.mod h1:RHo4/GmYcKKh5Lxu63wLEMHJ70Pac2JqZRYGhlyAo2M= github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI= github.com/dgraph-io/ristretto v0.1.0/go.mod h1:fux0lOrBhrVCJd3lcTHsIJhq1T2rokOu6v9Vcb3Q9ug= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= +github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= +github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= +github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w= +github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= +github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= +github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= @@ -75,6 +126,7 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= @@ -88,35 +140,80 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= +github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= +github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= +github.com/iris-contrib/i18n v0.0.0-20171121225848-987a633949d0/go.mod h1:pMCz62A0xJL6I+umB2YTlFRwWXaDFA0jy+5HzGiJjqI= +github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= +github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= +github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= +github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= +github.com/kataras/golog v0.0.9/go.mod h1:12HJgwBIZFNGL0EJnMRhmvGA0PQGx8VFwrZtM4CqbAk= +github.com/kataras/iris/v12 v12.0.1/go.mod h1:udK4vLQKkdDqMGJJVd/msuMtN6hpYJhg/lSzuxjhO+U= +github.com/kataras/neffos v0.0.10/go.mod h1:ZYmJC07hQPW67eKuzlfY7SO3bC0mw83A3j6im82hfqw= +github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiDuX9AhMbDPkGYSPugBOV6yTZB1l2K9Z0= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.9.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3 h1:G5AfA94pHPysR56qqrkO2pxEexdDzrpFJ6yt/VqWxVU= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= +github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= +github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed/go.mod h1:dSsfyI2zABAdhcbvkXqgxOxrCsbYeHCPgrZkku60dSg= +github.com/mediocregopher/radix/v3 v3.3.0/go.mod h1:EmfVyvspXz1uZEyPBMyGK+kjWiKQGvsUt6O3Pj+LDCQ= +github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= +github.com/nats-io/nats.go v1.8.1/go.mod h1:BrFz9vVn0fU3AcH9Vn4Kd7W0NpJ651tD5omQ3M8LwxM= +github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -124,6 +221,12 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -136,16 +239,31 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= +github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI= +github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= +github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= +github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= @@ -155,22 +273,35 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20200513190911-00229845015e h1:rMqLP+9XLy+LdbCXHjJHAmTfXCr93W7oruWA6Hq1Alc= +golang.org/x/exp v0.0.0-20200513190911-00229845015e/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -185,14 +316,20 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -202,6 +339,7 @@ golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210909193231-528a39cd75f3/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 h1:nhht2DYV/Sn3qOayu8lM+cU1ii9sTLUeBQwQQfUHtrs= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -209,11 +347,16 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -223,17 +366,20 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1N golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w= @@ -255,6 +401,9 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= +gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/goleveldb_iterator.go b/goleveldb_iterator.go index 9cf9a5e15..5341d1ac2 100644 --- a/goleveldb_iterator.go +++ b/goleveldb_iterator.go @@ -54,7 +54,6 @@ func (itr *goLevelDBIterator) Domain() ([]byte, []byte) { // Valid implements Iterator. func (itr *goLevelDBIterator) Valid() bool { - // Once invalid, forever invalid. if itr.isInvalid { return false @@ -73,9 +72,9 @@ func (itr *goLevelDBIterator) Valid() bool { } // If key is end or past it, invalid. - var start = itr.start - var end = itr.end - var key = itr.source.Key() + start := itr.start + end := itr.end + key := itr.source.Key() if itr.isReverse { if start != nil && bytes.Compare(key, start) < 0 { diff --git a/makefile b/makefile index bedebc457..f8b0f064e 100644 --- a/makefile +++ b/makefile @@ -28,6 +28,11 @@ test-badgerdb: @echo "--> Running go test" @go test $(PACKAGES) -tags badgerdb -v +test-pebble: + @echo "--> Running go test" + @go test $(PACKAGES) -tags pebbledb -v + + test-all: @echo "--> Running go test" @go test $(PACKAGES) -tags cleveldb,boltdb,rocksdb,badgerdb -v diff --git a/pebble.go b/pebble.go new file mode 100644 index 000000000..2f5cb6905 --- /dev/null +++ b/pebble.go @@ -0,0 +1,418 @@ +//go:build pebbledb + +package db + +import ( + "bytes" + "fmt" + "path/filepath" + + "github.com/cockroachdb/pebble" +) + +func init() { + dbCreator := func(name string, dir string) (DB, error) { + return NewPebbleDB(name, dir) + } + registerDBCreator(PebbleDBBackend, dbCreator, false) +} + +// PebbleDB is a PebbleDB backend. +type PebbleDB struct { + db *pebble.DB +} + +var _ DB = (*PebbleDB)(nil) + +func NewPebbleDB(name string, dir string) (DB, error) { + dbPath := filepath.Join(dir, name+".db") + // cache := pebble.NewCache(1024 * 1024 * 32) + // defer cache.Unref() + opts := &pebble.Options{ + // Cache: cache, + // FormatMajorVersion: pebble.FormatNewest, + // L0CompactionThreshold: 2, + // L0StopWritesThreshold: 1000, + // LBaseMaxBytes: 64 << 20, // 64 MB + // Levels: make([]pebble.LevelOptions, 7), + // MaxConcurrentCompactions: 3, + // MaxOpenFiles: 1024, + // MemTableSize: 64 << 20, + // MemTableStopWritesThreshold: 4, + } + /* + for i := 0; i < len(opts.Levels); i++ { + l := &opts.Levels[i] + l.BlockSize = 32 << 10 // 32 KB + l.IndexBlockSize = 256 << 10 // 256 KB + l.FilterPolicy = bloom.FilterPolicy(10) + l.FilterType = pebble.TableFilter + if i > 0 { + l.TargetFileSize = opts.Levels[i-1].TargetFileSize * 2 + } + l.EnsureDefaults() + } + */ + // opts.Levels[6].FilterPolicy = nil + // opts.FlushSplitBytes = opts.Levels[0].TargetFileSize + + opts.EnsureDefaults() + + p, err := pebble.Open(dbPath, opts) + if err != nil { + return nil, err + } + return &PebbleDB{ + db: p, + }, err +} + +// Get implements DB. +func (db *PebbleDB) Get(key []byte) ([]byte, error) { + if len(key) == 0 { + return nil, errKeyEmpty + } + res, closer, err := db.db.Get(key) + if err != nil { + return res, nil + } + closer.Close() + return res, nil +} + +// Has implements DB. +func (db *PebbleDB) Has(key []byte) (bool, error) { + if len(key) == 0 { + return false, errKeyEmpty + } + bytes, err := db.Get(key) + if err != nil { + return false, err + } + return bytes != nil, nil +} + +// Set implements DB. +func (db *PebbleDB) Set(key []byte, value []byte) error { + if len(key) == 0 { + return errKeyEmpty + } + if value == nil { + return errValueNil + } + err := db.db.Set(key, value, pebble.NoSync) + if err != nil { + return err + } + return nil +} + +// SetSync implements DB. +func (db *PebbleDB) SetSync(key []byte, value []byte) error { + if len(key) == 0 { + return errKeyEmpty + } + if value == nil { + return errValueNil + } + err := db.db.Set(key, value, pebble.Sync) + if err != nil { + return err + } + return nil +} + +// Delete implements DB. +func (db *PebbleDB) Delete(key []byte) error { + if len(key) == 0 { + return errKeyEmpty + } + err := db.db.Delete(key, pebble.NoSync) + if err != nil { + return err + } + return nil +} + +// DeleteSync implements DB. +func (db PebbleDB) DeleteSync(key []byte) error { + if len(key) == 0 { + return errKeyEmpty + } + err := db.db.Delete(key, pebble.Sync) + if err != nil { + return nil + } + return nil +} + +func (db *PebbleDB) DB() *pebble.DB { + return db.db +} + +// Close implements DB. +func (db PebbleDB) Close() error { + db.db.Close() + return nil +} + +// Print implements DB. +func (db *PebbleDB) Print() error { + itr, err := db.Iterator(nil, nil) + if err != nil { + return err + } + defer itr.Close() + for ; itr.Valid(); itr.Next() { + key := itr.Key() + value := itr.Value() + fmt.Printf("[%X]:\t[%X]\n", key, value) + } + return nil +} + +// Stats implements DB. +func (db *PebbleDB) Stats() map[string]string { + /* + keys := []string{"rocksdb.stats"} + stats := make(map[string]string, len(keys)) + for _, key := range keys { + stats[key] = db.(key) + } + */ + return nil +} + +// NewBatch implements DB. +func (db *PebbleDB) NewBatch() Batch { + return newPebbleDBBatch(db) +} + +// Iterator implements DB. +func (db *PebbleDB) Iterator(start, end []byte) (Iterator, error) { + if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { + return nil, errKeyEmpty + } + o := pebble.IterOptions{ + LowerBound: start, + UpperBound: end, + } + itr := db.db.NewIter(&o) + itr.First() + + return newPebbleDBIterator(itr, start, end, false), nil +} + +// ReverseIterator implements DB. +func (db *PebbleDB) ReverseIterator(start, end []byte) (Iterator, error) { + if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { + return nil, errKeyEmpty + } + o := pebble.IterOptions{ + LowerBound: start, + UpperBound: end, + } + itr := db.db.NewIter(&o) + itr.Last() + return newPebbleDBIterator(itr, start, end, true), nil +} + +var _ Batch = (*pebbleDBBatch)(nil) + +type pebbleDBBatch struct { + db *PebbleDB + batch *pebble.Batch +} + +var _ Batch = (*pebbleDBBatch)(nil) + +func newPebbleDBBatch(db *PebbleDB) *pebbleDBBatch { + return &pebbleDBBatch{ + batch: db.db.NewBatch(), + } +} + +// Set implements Batch. +func (b *pebbleDBBatch) Set(key, value []byte) error { + if len(key) == 0 { + return errKeyEmpty + } + if value == nil { + return errValueNil + } + if b.batch == nil { + return errBatchClosed + } + b.batch.Set(key, value, nil) + return nil +} + +// Delete implements Batch. +func (b *pebbleDBBatch) Delete(key []byte) error { + if len(key) == 0 { + return errKeyEmpty + } + if b.batch == nil { + return errBatchClosed + } + b.batch.Delete(key, nil) + return nil +} + +// Write implements Batch. +func (b *pebbleDBBatch) Write() error { + if b.batch == nil { + return errBatchClosed + } + err := b.batch.Commit(pebble.NoSync) + if err != nil { + return err + } + // Make sure batch cannot be used afterwards. Callers should still call Close(), for errors. + + return b.Close() +} + +// WriteSync implements Batch. +func (b *pebbleDBBatch) WriteSync() error { + if b.batch == nil { + return errBatchClosed + } + err := b.batch.Commit(pebble.Sync) + if err != nil { + return err + } + // Make sure batch cannot be used afterwards. Callers should still call Close(), for errors. + return b.Close() +} + +// Close implements Batch. +func (b *pebbleDBBatch) Close() error { + if b.batch != nil { + err := b.batch.Close() + if err != nil { + return err + } + b.batch = nil + } + + return nil +} + +type pebbleDBIterator struct { + source *pebble.Iterator + start, end []byte + isReverse bool + isInvalid bool +} + +var _ Iterator = (*pebbleDBIterator)(nil) + +func newPebbleDBIterator(source *pebble.Iterator, start, end []byte, isReverse bool) *pebbleDBIterator { + if isReverse { + if end == nil { + source.Last() + } + } else { + if start == nil { + source.First() + } + } + return &pebbleDBIterator{ + source: source, + start: start, + end: end, + isReverse: isReverse, + isInvalid: false, + } +} + +// Domain implements Iterator. +func (itr *pebbleDBIterator) Domain() ([]byte, []byte) { + return itr.start, itr.end +} + +// Valid implements Iterator. +func (itr *pebbleDBIterator) Valid() bool { + // Once invalid, forever invalid. + if itr.isInvalid { + return false + } + + // If source has error, invalid. + if err := itr.source.Error(); err != nil { + itr.isInvalid = true + + return false + } + + // If source is invalid, invalid. + if !itr.source.Valid() { + itr.isInvalid = true + + return false + } + + // If key is end or past it, invalid. + start := itr.start + end := itr.end + key := itr.source.Key() + if itr.isReverse { + if start != nil && bytes.Compare(key, start) < 0 { + itr.isInvalid = true + + return false + } + } else { + if end != nil && bytes.Compare(end, key) <= 0 { + itr.isInvalid = true + + return false + } + } + + // It's valid. + return true +} + +// Key implements Iterator. +func (itr *pebbleDBIterator) Key() []byte { + itr.assertIsValid() + return itr.source.Key() +} + +// Value implements Iterator. +func (itr *pebbleDBIterator) Value() []byte { + itr.assertIsValid() + return itr.source.Value() +} + +// Next implements Iterator. +func (itr pebbleDBIterator) Next() { + itr.assertIsValid() + if itr.isReverse { + itr.source.Prev() + } else { + itr.source.Next() + } +} + +// Error implements Iterator. +func (itr *pebbleDBIterator) Error() error { + return itr.source.Error() +} + +// Close implements Iterator. +func (itr *pebbleDBIterator) Close() error { + err := itr.source.Close() + if err != nil { + return err + } + return nil +} + +func (itr *pebbleDBIterator) assertIsValid() { + if !itr.Valid() { + panic("iterator is invalid") + } +} diff --git a/pebble_test.go b/pebble_test.go new file mode 100644 index 000000000..9837b3f78 --- /dev/null +++ b/pebble_test.go @@ -0,0 +1,50 @@ +//go:build pebbledb + +package db + +import ( + "fmt" + "os" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestPebbleDBBackend(t *testing.T) { + name := fmt.Sprintf("test_%x", randStr(12)) + dir := os.TempDir() + db, err := NewDB(name, PebbleDBBackend, dir) + require.NoError(t, err) + defer cleanupDBDir(dir, name) + + _, ok := db.(*PebbleDB) + assert.True(t, ok) +} + +// func TestPebbleDBStats(t *testing.T) { +// name := fmt.Sprintf("test_%x", randStr(12)) +// dir := os.TempDir() +// db, err := NewDB(name, PebbleDBBackend, dir) +// require.NoError(t, err) +// defer cleanupDBDir(dir, name) + +// assert.NotEmpty(t, db.Stats()) +// } + +func BenchmarkPebbleDBRandomReadsWrites(b *testing.B) { + name := fmt.Sprintf("test_%x", randStr(12)) + dir := os.TempDir() + db, err := NewDB(name, PebbleDBBackend, dir) + if err != nil { + b.Fatal(err) + } + defer func() { + db.Close() + cleanupDBDir("", name) + }() + + benchmarkRandomReadsWrites(b, db) +} + +// TODO: Add tests for pebble diff --git a/prefixdb_iterator.go b/prefixdb_iterator.go index 79e1ef7fa..8f2f93262 100644 --- a/prefixdb_iterator.go +++ b/prefixdb_iterator.go @@ -91,7 +91,6 @@ func (itr *prefixDBIterator) Next() { if !itr.source.Valid() || !bytes.HasPrefix(itr.source.Key(), itr.prefix) { itr.valid = false - } else if bytes.Equal(itr.source.Key(), itr.prefix) { // Empty keys are not allowed, so if a key exists in the database that exactly matches the // prefix we need to skip it. diff --git a/rocksdb.go b/rocksdb.go index dd9be2a36..06d056dd8 100644 --- a/rocksdb.go +++ b/rocksdb.go @@ -1,3 +1,4 @@ +//go:build rocksdb // +build rocksdb package db diff --git a/rocksdb_batch.go b/rocksdb_batch.go index af7e65c60..b2557ac45 100644 --- a/rocksdb_batch.go +++ b/rocksdb_batch.go @@ -1,3 +1,4 @@ +//go:build rocksdb // +build rocksdb package db diff --git a/rocksdb_iterator.go b/rocksdb_iterator.go index 9970c169e..e79a76cd6 100644 --- a/rocksdb_iterator.go +++ b/rocksdb_iterator.go @@ -1,3 +1,4 @@ +//go:build rocksdb // +build rocksdb package db @@ -55,7 +56,6 @@ func (itr *rocksDBIterator) Domain() ([]byte, []byte) { // Valid implements Iterator. func (itr *rocksDBIterator) Valid() bool { - // Once invalid, forever invalid. if itr.isInvalid { return false @@ -74,9 +74,9 @@ func (itr *rocksDBIterator) Valid() bool { } // If key is end or past it, invalid. - var start = itr.start - var end = itr.end - var key = moveSliceToBytes(itr.source.Key()) + start := itr.start + end := itr.end + key := moveSliceToBytes(itr.source.Key()) if itr.isReverse { if start != nil && bytes.Compare(key, start) < 0 { itr.isInvalid = true diff --git a/rocksdb_test.go b/rocksdb_test.go index 6bbe51133..4eddbc56b 100644 --- a/rocksdb_test.go +++ b/rocksdb_test.go @@ -1,3 +1,4 @@ +//go:build rocksdb // +build rocksdb package db From eeadeb81cda78206a9524c57d3b240f021f5ef5e Mon Sep 17 00:00:00 2001 From: Tuan Pham Anh Date: Mon, 25 Jul 2022 10:26:45 +0700 Subject: [PATCH 02/26] log calls --- pebble.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pebble.go b/pebble.go index 2f5cb6905..09b65c35d 100644 --- a/pebble.go +++ b/pebble.go @@ -69,6 +69,7 @@ func NewPebbleDB(name string, dir string) (DB, error) { // Get implements DB. func (db *PebbleDB) Get(key []byte) ([]byte, error) { + fmt.Println("PebbleDB.Get") if len(key) == 0 { return nil, errKeyEmpty } @@ -82,6 +83,7 @@ func (db *PebbleDB) Get(key []byte) ([]byte, error) { // Has implements DB. func (db *PebbleDB) Has(key []byte) (bool, error) { + fmt.Println("PebbleDB.Has") if len(key) == 0 { return false, errKeyEmpty } @@ -94,6 +96,7 @@ func (db *PebbleDB) Has(key []byte) (bool, error) { // Set implements DB. func (db *PebbleDB) Set(key []byte, value []byte) error { + fmt.Println("PebbleDB.Set") if len(key) == 0 { return errKeyEmpty } @@ -109,6 +112,7 @@ func (db *PebbleDB) Set(key []byte, value []byte) error { // SetSync implements DB. func (db *PebbleDB) SetSync(key []byte, value []byte) error { + fmt.Println("PebbleDB.SetSync") if len(key) == 0 { return errKeyEmpty } @@ -124,6 +128,7 @@ func (db *PebbleDB) SetSync(key []byte, value []byte) error { // Delete implements DB. func (db *PebbleDB) Delete(key []byte) error { + fmt.Println("PebbleDB.Delete") if len(key) == 0 { return errKeyEmpty } @@ -136,6 +141,7 @@ func (db *PebbleDB) Delete(key []byte) error { // DeleteSync implements DB. func (db PebbleDB) DeleteSync(key []byte) error { + fmt.Println("PebbleDB.DeleteSync") if len(key) == 0 { return errKeyEmpty } @@ -152,6 +158,7 @@ func (db *PebbleDB) DB() *pebble.DB { // Close implements DB. func (db PebbleDB) Close() error { + fmt.Println("PebbleDB.Close") db.db.Close() return nil } @@ -190,6 +197,7 @@ func (db *PebbleDB) NewBatch() Batch { // Iterator implements DB. func (db *PebbleDB) Iterator(start, end []byte) (Iterator, error) { + fmt.Println("PebbleDB.Iterator") if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { return nil, errKeyEmpty } @@ -205,6 +213,7 @@ func (db *PebbleDB) Iterator(start, end []byte) (Iterator, error) { // ReverseIterator implements DB. func (db *PebbleDB) ReverseIterator(start, end []byte) (Iterator, error) { + fmt.Println("PebbleDB.ReverseIterator") if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { return nil, errKeyEmpty } @@ -234,6 +243,7 @@ func newPebbleDBBatch(db *PebbleDB) *pebbleDBBatch { // Set implements Batch. func (b *pebbleDBBatch) Set(key, value []byte) error { + fmt.Println("pebbleDBBatch.Set") if len(key) == 0 { return errKeyEmpty } @@ -249,6 +259,7 @@ func (b *pebbleDBBatch) Set(key, value []byte) error { // Delete implements Batch. func (b *pebbleDBBatch) Delete(key []byte) error { + fmt.Println("pebbleDBBatch.Delete") if len(key) == 0 { return errKeyEmpty } @@ -261,6 +272,7 @@ func (b *pebbleDBBatch) Delete(key []byte) error { // Write implements Batch. func (b *pebbleDBBatch) Write() error { + fmt.Println("pebbleDBBatch.Write") if b.batch == nil { return errBatchClosed } @@ -275,6 +287,7 @@ func (b *pebbleDBBatch) Write() error { // WriteSync implements Batch. func (b *pebbleDBBatch) WriteSync() error { + fmt.Println("pebbleDBBatch.WriteSync") if b.batch == nil { return errBatchClosed } @@ -288,6 +301,7 @@ func (b *pebbleDBBatch) WriteSync() error { // Close implements Batch. func (b *pebbleDBBatch) Close() error { + fmt.Println("pebbleDBBatch.Close") if b.batch != nil { err := b.batch.Close() if err != nil { @@ -329,11 +343,13 @@ func newPebbleDBIterator(source *pebble.Iterator, start, end []byte, isReverse b // Domain implements Iterator. func (itr *pebbleDBIterator) Domain() ([]byte, []byte) { + fmt.Println("pebbleDBIterator.Domain") return itr.start, itr.end } // Valid implements Iterator. func (itr *pebbleDBIterator) Valid() bool { + fmt.Println("pebbleDBIterator.Valid") // Once invalid, forever invalid. if itr.isInvalid { return false @@ -377,18 +393,21 @@ func (itr *pebbleDBIterator) Valid() bool { // Key implements Iterator. func (itr *pebbleDBIterator) Key() []byte { + fmt.Println("pebbleDBIterator.Key") itr.assertIsValid() return itr.source.Key() } // Value implements Iterator. func (itr *pebbleDBIterator) Value() []byte { + fmt.Println("pebbleDBIterator.Value") itr.assertIsValid() return itr.source.Value() } // Next implements Iterator. func (itr pebbleDBIterator) Next() { + fmt.Println("pebbleDBIterator.Next") itr.assertIsValid() if itr.isReverse { itr.source.Prev() @@ -404,6 +423,7 @@ func (itr *pebbleDBIterator) Error() error { // Close implements Iterator. func (itr *pebbleDBIterator) Close() error { + fmt.Println("pebbleDBIterator.Close") err := itr.source.Close() if err != nil { return err From 248b9f9620093fe067b086a8137344d33ab49539 Mon Sep 17 00:00:00 2001 From: Tuan Pham Anh Date: Mon, 25 Jul 2022 15:53:32 +0700 Subject: [PATCH 03/26] try NoCompression --- pebble.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pebble.go b/pebble.go index 09b65c35d..b3d9967ff 100644 --- a/pebble.go +++ b/pebble.go @@ -56,6 +56,12 @@ func NewPebbleDB(name string, dir string) (DB, error) { // opts.Levels[6].FilterPolicy = nil // opts.FlushSplitBytes = opts.Levels[0].TargetFileSize + for i := 0; i < len(opts.Levels); i++ { + l := &opts.Levels[i] + l.Compression = pebble.NoCompression + l.EnsureDefaults() + } + opts.EnsureDefaults() p, err := pebble.Open(dbPath, opts) From ecbddc37e1b9094ad2cf76225722ad10ec86203b Mon Sep 17 00:00:00 2001 From: Tuan Pham Anh Date: Mon, 25 Jul 2022 21:19:25 +0700 Subject: [PATCH 04/26] DisableAutomaticCompactions = true --- pebble.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pebble.go b/pebble.go index b3d9967ff..6450ad73b 100644 --- a/pebble.go +++ b/pebble.go @@ -62,6 +62,8 @@ func NewPebbleDB(name string, dir string) (DB, error) { l.EnsureDefaults() } + opts.DisableAutomaticCompactions = true + opts.EnsureDefaults() p, err := pebble.Open(dbPath, opts) From cc357e3afc76deffe7edce122a9f7a4b74739783 Mon Sep 17 00:00:00 2001 From: Tuan Pham Anh Date: Wed, 27 Jul 2022 16:15:33 +0700 Subject: [PATCH 05/26] Revert "log calls" This reverts commit eeadeb81cda78206a9524c57d3b240f021f5ef5e. --- pebble.go | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/pebble.go b/pebble.go index 6450ad73b..95d46bc20 100644 --- a/pebble.go +++ b/pebble.go @@ -77,7 +77,6 @@ func NewPebbleDB(name string, dir string) (DB, error) { // Get implements DB. func (db *PebbleDB) Get(key []byte) ([]byte, error) { - fmt.Println("PebbleDB.Get") if len(key) == 0 { return nil, errKeyEmpty } @@ -91,7 +90,6 @@ func (db *PebbleDB) Get(key []byte) ([]byte, error) { // Has implements DB. func (db *PebbleDB) Has(key []byte) (bool, error) { - fmt.Println("PebbleDB.Has") if len(key) == 0 { return false, errKeyEmpty } @@ -104,7 +102,6 @@ func (db *PebbleDB) Has(key []byte) (bool, error) { // Set implements DB. func (db *PebbleDB) Set(key []byte, value []byte) error { - fmt.Println("PebbleDB.Set") if len(key) == 0 { return errKeyEmpty } @@ -120,7 +117,6 @@ func (db *PebbleDB) Set(key []byte, value []byte) error { // SetSync implements DB. func (db *PebbleDB) SetSync(key []byte, value []byte) error { - fmt.Println("PebbleDB.SetSync") if len(key) == 0 { return errKeyEmpty } @@ -136,7 +132,6 @@ func (db *PebbleDB) SetSync(key []byte, value []byte) error { // Delete implements DB. func (db *PebbleDB) Delete(key []byte) error { - fmt.Println("PebbleDB.Delete") if len(key) == 0 { return errKeyEmpty } @@ -149,7 +144,6 @@ func (db *PebbleDB) Delete(key []byte) error { // DeleteSync implements DB. func (db PebbleDB) DeleteSync(key []byte) error { - fmt.Println("PebbleDB.DeleteSync") if len(key) == 0 { return errKeyEmpty } @@ -166,7 +160,6 @@ func (db *PebbleDB) DB() *pebble.DB { // Close implements DB. func (db PebbleDB) Close() error { - fmt.Println("PebbleDB.Close") db.db.Close() return nil } @@ -205,7 +198,6 @@ func (db *PebbleDB) NewBatch() Batch { // Iterator implements DB. func (db *PebbleDB) Iterator(start, end []byte) (Iterator, error) { - fmt.Println("PebbleDB.Iterator") if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { return nil, errKeyEmpty } @@ -221,7 +213,6 @@ func (db *PebbleDB) Iterator(start, end []byte) (Iterator, error) { // ReverseIterator implements DB. func (db *PebbleDB) ReverseIterator(start, end []byte) (Iterator, error) { - fmt.Println("PebbleDB.ReverseIterator") if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { return nil, errKeyEmpty } @@ -251,7 +242,6 @@ func newPebbleDBBatch(db *PebbleDB) *pebbleDBBatch { // Set implements Batch. func (b *pebbleDBBatch) Set(key, value []byte) error { - fmt.Println("pebbleDBBatch.Set") if len(key) == 0 { return errKeyEmpty } @@ -267,7 +257,6 @@ func (b *pebbleDBBatch) Set(key, value []byte) error { // Delete implements Batch. func (b *pebbleDBBatch) Delete(key []byte) error { - fmt.Println("pebbleDBBatch.Delete") if len(key) == 0 { return errKeyEmpty } @@ -280,7 +269,6 @@ func (b *pebbleDBBatch) Delete(key []byte) error { // Write implements Batch. func (b *pebbleDBBatch) Write() error { - fmt.Println("pebbleDBBatch.Write") if b.batch == nil { return errBatchClosed } @@ -295,7 +283,6 @@ func (b *pebbleDBBatch) Write() error { // WriteSync implements Batch. func (b *pebbleDBBatch) WriteSync() error { - fmt.Println("pebbleDBBatch.WriteSync") if b.batch == nil { return errBatchClosed } @@ -309,7 +296,6 @@ func (b *pebbleDBBatch) WriteSync() error { // Close implements Batch. func (b *pebbleDBBatch) Close() error { - fmt.Println("pebbleDBBatch.Close") if b.batch != nil { err := b.batch.Close() if err != nil { @@ -351,13 +337,11 @@ func newPebbleDBIterator(source *pebble.Iterator, start, end []byte, isReverse b // Domain implements Iterator. func (itr *pebbleDBIterator) Domain() ([]byte, []byte) { - fmt.Println("pebbleDBIterator.Domain") return itr.start, itr.end } // Valid implements Iterator. func (itr *pebbleDBIterator) Valid() bool { - fmt.Println("pebbleDBIterator.Valid") // Once invalid, forever invalid. if itr.isInvalid { return false @@ -401,21 +385,18 @@ func (itr *pebbleDBIterator) Valid() bool { // Key implements Iterator. func (itr *pebbleDBIterator) Key() []byte { - fmt.Println("pebbleDBIterator.Key") itr.assertIsValid() return itr.source.Key() } // Value implements Iterator. func (itr *pebbleDBIterator) Value() []byte { - fmt.Println("pebbleDBIterator.Value") itr.assertIsValid() return itr.source.Value() } // Next implements Iterator. func (itr pebbleDBIterator) Next() { - fmt.Println("pebbleDBIterator.Next") itr.assertIsValid() if itr.isReverse { itr.source.Prev() @@ -431,7 +412,6 @@ func (itr *pebbleDBIterator) Error() error { // Close implements Iterator. func (itr *pebbleDBIterator) Close() error { - fmt.Println("pebbleDBIterator.Close") err := itr.source.Close() if err != nil { return err From d91c16814176a4846a391053ada1834d6b0e1c15 Mon Sep 17 00:00:00 2001 From: Tuan Pham Anh Date: Wed, 27 Jul 2022 16:31:42 +0700 Subject: [PATCH 06/26] ... --- go.mod | 10 ++++++---- go.sum | 40 +++++++++++++++++++++++++++++++++------- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 1e89c07cb..7d1f3df0e 100644 --- a/go.mod +++ b/go.mod @@ -14,19 +14,21 @@ require ( google.golang.org/grpc v1.48.0 ) -require github.com/cockroachdb/pebble v0.0.0-20220421143146-8decd08cdb9d +require ( + github.com/cockroachdb/pebble v0.0.0-20220726134658-7b78c71e4055 + github.com/dgraph-io/badger/v3 v3.2103.2 +) require ( github.com/DataDog/zstd v1.4.5 // indirect + github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.1.1 // indirect github.com/cockroachdb/errors v1.8.1 // indirect github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f // indirect github.com/cockroachdb/redact v1.0.8 // indirect github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 // indirect - github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/dgraph-io/badger/v3 v3.2103.2 github.com/dgraph-io/ristretto v0.1.0 // indirect github.com/dustin/go-humanize v1.0.0 // indirect github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect @@ -35,7 +37,7 @@ require ( github.com/google/flatbuffers v1.12.1 // indirect github.com/klauspost/compress v1.12.3 // indirect github.com/kr/pretty v0.1.0 // indirect - github.com/kr/text v0.1.0 // indirect + github.com/kr/text v0.2.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opencensus.io v0.22.5 // indirect diff --git a/go.sum b/go.sum index 456b17c71..ffdd56caf 100644 --- a/go.sum +++ b/go.sum @@ -8,12 +8,15 @@ github.com/CloudyKit/fastprinter v0.0.0-20170127035650-74b38d55f37a/go.mod h1:EF github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible/go.mod h1:HPYO+50pSWkPoj9Q/eq0aRGByCL6ScRlUmiEX5Zgm+w= github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= +github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7/go.mod h1:6E6s8o2AE4KhCrqr6GRJjdC/gNfTdxkIXvuGZZda2VM= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= +github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= @@ -35,14 +38,12 @@ github.com/cockroachdb/errors v1.8.1 h1:A5+txlVZfOqFBDa4mGz2bUWSp0aHElvHX2bKkdbQ github.com/cockroachdb/errors v1.8.1/go.mod h1:qGwQn6JmZ+oMjuLwjWzUNqblqk0xl4CVV3SQbGwK7Ac= github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= -github.com/cockroachdb/pebble v0.0.0-20220421143146-8decd08cdb9d h1:rMLrmABNLB5RPEvy/lynjDL1EyCCXpcjBtCgt4D9DTs= -github.com/cockroachdb/pebble v0.0.0-20220421143146-8decd08cdb9d/go.mod h1:buxOO9GBtOcq1DiXDpIPYrmxY020K2A8lOrwno5FetU= +github.com/cockroachdb/pebble v0.0.0-20220726134658-7b78c71e4055 h1:lKgbA+hhzIse5eXx1aZwpHAnPKTp1mtQnJRZJbLwJtU= +github.com/cockroachdb/pebble v0.0.0-20220726134658-7b78c71e4055/go.mod h1:890yq1fUb9b6dGNwssgeUO5vQV9qfXnCPxAJhBQfXw0= github.com/cockroachdb/redact v1.0.8 h1:8QG/764wK+vmEYoOlfobpe12EQcS81ukx/a4hdVMxNw= github.com/cockroachdb/redact v1.0.8/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= @@ -50,6 +51,7 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -81,6 +83,7 @@ github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+ne github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA= +github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -92,6 +95,7 @@ github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/ github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= @@ -103,6 +107,7 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= @@ -146,6 +151,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= @@ -162,6 +168,7 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= +github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/kataras/golog v0.0.9/go.mod h1:12HJgwBIZFNGL0EJnMRhmvGA0PQGx8VFwrZtM4CqbAk= github.com/kataras/iris/v12 v12.0.1/go.mod h1:udK4vLQKkdDqMGJJVd/msuMtN6hpYJhg/lSzuxjhO+U= @@ -179,8 +186,9 @@ github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgo github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -200,6 +208,8 @@ github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOA github.com/nats-io/nats.go v1.8.1/go.mod h1:BrFz9vVn0fU3AcH9Vn4Kd7W0NpJ651tD5omQ3M8LwxM= github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -242,7 +252,6 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= @@ -273,19 +282,26 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/exp v0.0.0-20200513190911-00229845015e h1:rMqLP+9XLy+LdbCXHjJHAmTfXCr93W7oruWA6Hq1Alc= golang.org/x/exp v0.0.0-20200513190911-00229845015e/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -346,15 +362,18 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -364,6 +383,11 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.8.2 h1:CCXrcPKiGGotvnN6jfUsKk4rRqm7q09/YbKb5xCEvtM= +gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= +gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= @@ -398,8 +422,9 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= @@ -416,3 +441,4 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= From e3f5da3778f0d15f30caf2e28deffa0b6401d82f Mon Sep 17 00:00:00 2001 From: Tuan Pham Anh Date: Thu, 28 Jul 2022 14:43:53 +0700 Subject: [PATCH 07/26] fix pebble --- pebble.go | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/pebble.go b/pebble.go index 95d46bc20..0d8fcc9fd 100644 --- a/pebble.go +++ b/pebble.go @@ -77,12 +77,14 @@ func NewPebbleDB(name string, dir string) (DB, error) { // Get implements DB. func (db *PebbleDB) Get(key []byte) ([]byte, error) { + fmt.Println("PebbleDB.Get") if len(key) == 0 { return nil, errKeyEmpty } res, closer, err := db.db.Get(key) + v := cp(res) if err != nil { - return res, nil + return v, nil } closer.Close() return res, nil @@ -90,6 +92,7 @@ func (db *PebbleDB) Get(key []byte) ([]byte, error) { // Has implements DB. func (db *PebbleDB) Has(key []byte) (bool, error) { + fmt.Println("PebbleDB.Has") if len(key) == 0 { return false, errKeyEmpty } @@ -102,6 +105,7 @@ func (db *PebbleDB) Has(key []byte) (bool, error) { // Set implements DB. func (db *PebbleDB) Set(key []byte, value []byte) error { + fmt.Println("PebbleDB.Set") if len(key) == 0 { return errKeyEmpty } @@ -117,6 +121,7 @@ func (db *PebbleDB) Set(key []byte, value []byte) error { // SetSync implements DB. func (db *PebbleDB) SetSync(key []byte, value []byte) error { + fmt.Println("PebbleDB.SetSync") if len(key) == 0 { return errKeyEmpty } @@ -132,6 +137,7 @@ func (db *PebbleDB) SetSync(key []byte, value []byte) error { // Delete implements DB. func (db *PebbleDB) Delete(key []byte) error { + fmt.Println("PebbleDB.Delete") if len(key) == 0 { return errKeyEmpty } @@ -144,6 +150,7 @@ func (db *PebbleDB) Delete(key []byte) error { // DeleteSync implements DB. func (db PebbleDB) DeleteSync(key []byte) error { + fmt.Println("PebbleDB.DeleteSync") if len(key) == 0 { return errKeyEmpty } @@ -160,6 +167,7 @@ func (db *PebbleDB) DB() *pebble.DB { // Close implements DB. func (db PebbleDB) Close() error { + fmt.Println("PebbleDB.Close") db.db.Close() return nil } @@ -198,6 +206,7 @@ func (db *PebbleDB) NewBatch() Batch { // Iterator implements DB. func (db *PebbleDB) Iterator(start, end []byte) (Iterator, error) { + fmt.Println("PebbleDB.Iterator") if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { return nil, errKeyEmpty } @@ -213,6 +222,7 @@ func (db *PebbleDB) Iterator(start, end []byte) (Iterator, error) { // ReverseIterator implements DB. func (db *PebbleDB) ReverseIterator(start, end []byte) (Iterator, error) { + fmt.Println("PebbleDB.ReverseIterator") if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { return nil, errKeyEmpty } @@ -242,6 +252,7 @@ func newPebbleDBBatch(db *PebbleDB) *pebbleDBBatch { // Set implements Batch. func (b *pebbleDBBatch) Set(key, value []byte) error { + fmt.Println("pebbleDBBatch.Set") if len(key) == 0 { return errKeyEmpty } @@ -257,6 +268,7 @@ func (b *pebbleDBBatch) Set(key, value []byte) error { // Delete implements Batch. func (b *pebbleDBBatch) Delete(key []byte) error { + fmt.Println("pebbleDBBatch.Delete") if len(key) == 0 { return errKeyEmpty } @@ -269,6 +281,7 @@ func (b *pebbleDBBatch) Delete(key []byte) error { // Write implements Batch. func (b *pebbleDBBatch) Write() error { + fmt.Println("pebbleDBBatch.Write") if b.batch == nil { return errBatchClosed } @@ -283,6 +296,7 @@ func (b *pebbleDBBatch) Write() error { // WriteSync implements Batch. func (b *pebbleDBBatch) WriteSync() error { + fmt.Println("pebbleDBBatch.WriteSync") if b.batch == nil { return errBatchClosed } @@ -296,6 +310,7 @@ func (b *pebbleDBBatch) WriteSync() error { // Close implements Batch. func (b *pebbleDBBatch) Close() error { + fmt.Println("pebbleDBBatch.Close") if b.batch != nil { err := b.batch.Close() if err != nil { @@ -337,11 +352,13 @@ func newPebbleDBIterator(source *pebble.Iterator, start, end []byte, isReverse b // Domain implements Iterator. func (itr *pebbleDBIterator) Domain() ([]byte, []byte) { + fmt.Println("pebbleDBIterator.Domain") return itr.start, itr.end } // Valid implements Iterator. func (itr *pebbleDBIterator) Valid() bool { + fmt.Println("pebbleDBIterator.Valid") // Once invalid, forever invalid. if itr.isInvalid { return false @@ -385,18 +402,21 @@ func (itr *pebbleDBIterator) Valid() bool { // Key implements Iterator. func (itr *pebbleDBIterator) Key() []byte { + fmt.Println("pebbleDBIterator.Key") itr.assertIsValid() - return itr.source.Key() + return cp(itr.source.Key()) } // Value implements Iterator. func (itr *pebbleDBIterator) Value() []byte { + fmt.Println("pebbleDBIterator.Value") itr.assertIsValid() - return itr.source.Value() + return cp(itr.source.Value()) } // Next implements Iterator. func (itr pebbleDBIterator) Next() { + fmt.Println("pebbleDBIterator.Next") itr.assertIsValid() if itr.isReverse { itr.source.Prev() @@ -412,6 +432,7 @@ func (itr *pebbleDBIterator) Error() error { // Close implements Iterator. func (itr *pebbleDBIterator) Close() error { + fmt.Println("pebbleDBIterator.Close") err := itr.source.Close() if err != nil { return err From 6633d2466a34d1edee082d742f8b43f5c5a7aaf1 Mon Sep 17 00:00:00 2001 From: Tuan Pham Anh Date: Thu, 28 Jul 2022 15:17:11 +0700 Subject: [PATCH 08/26] fix PebbleDB.Get --- pebble.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pebble.go b/pebble.go index 0d8fcc9fd..046ce2fd3 100644 --- a/pebble.go +++ b/pebble.go @@ -83,10 +83,10 @@ func (db *PebbleDB) Get(key []byte) ([]byte, error) { } res, closer, err := db.db.Get(key) v := cp(res) + closer.Close() if err != nil { - return v, nil + return nil, err } - closer.Close() return res, nil } From 0b885bbb8f56ad3bcd42665c5f843fb258e3d417 Mon Sep 17 00:00:00 2001 From: Tuan Pham Anh Date: Thu, 28 Jul 2022 15:45:56 +0700 Subject: [PATCH 09/26] fix PebbleDB.Get... --- pebble.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pebble.go b/pebble.go index 046ce2fd3..94e007f80 100644 --- a/pebble.go +++ b/pebble.go @@ -81,13 +81,18 @@ func (db *PebbleDB) Get(key []byte) ([]byte, error) { if len(key) == 0 { return nil, errKeyEmpty } + res, closer, err := db.db.Get(key) - v := cp(res) - closer.Close() + if err != nil { + if err == pebble.ErrNotFound { + return nil, nil + } return nil, err } - return res, nil + defer closer.Close() + + return cp(res), nil } // Has implements DB. From 9cc487937df0ccf47d63c4125625f24c279289ef Mon Sep 17 00:00:00 2001 From: Tuan Pham Anh Date: Thu, 28 Jul 2022 16:04:22 +0700 Subject: [PATCH 10/26] ... --- pebble.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pebble.go b/pebble.go index 94e007f80..cabed9f6c 100644 --- a/pebble.go +++ b/pebble.go @@ -56,13 +56,13 @@ func NewPebbleDB(name string, dir string) (DB, error) { // opts.Levels[6].FilterPolicy = nil // opts.FlushSplitBytes = opts.Levels[0].TargetFileSize - for i := 0; i < len(opts.Levels); i++ { - l := &opts.Levels[i] - l.Compression = pebble.NoCompression - l.EnsureDefaults() - } - - opts.DisableAutomaticCompactions = true + //for i := 0; i < len(opts.Levels); i++ { + // l := &opts.Levels[i] + // l.Compression = pebble.NoCompression + // l.EnsureDefaults() + //} + // + //opts.DisableAutomaticCompactions = true opts.EnsureDefaults() From 7c0a33fd88c8c37bf645a2ede2e20b8453d18d1f Mon Sep 17 00:00:00 2001 From: Tuan Pham Anh Date: Thu, 28 Jul 2022 17:14:01 +0700 Subject: [PATCH 11/26] comment all fmt.Println log debugging --- pebble.go | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/pebble.go b/pebble.go index cabed9f6c..00e04b455 100644 --- a/pebble.go +++ b/pebble.go @@ -77,7 +77,7 @@ func NewPebbleDB(name string, dir string) (DB, error) { // Get implements DB. func (db *PebbleDB) Get(key []byte) ([]byte, error) { - fmt.Println("PebbleDB.Get") + //fmt.Println("PebbleDB.Get") if len(key) == 0 { return nil, errKeyEmpty } @@ -97,7 +97,7 @@ func (db *PebbleDB) Get(key []byte) ([]byte, error) { // Has implements DB. func (db *PebbleDB) Has(key []byte) (bool, error) { - fmt.Println("PebbleDB.Has") + //fmt.Println("PebbleDB.Has") if len(key) == 0 { return false, errKeyEmpty } @@ -110,7 +110,7 @@ func (db *PebbleDB) Has(key []byte) (bool, error) { // Set implements DB. func (db *PebbleDB) Set(key []byte, value []byte) error { - fmt.Println("PebbleDB.Set") + //fmt.Println("PebbleDB.Set") if len(key) == 0 { return errKeyEmpty } @@ -126,7 +126,7 @@ func (db *PebbleDB) Set(key []byte, value []byte) error { // SetSync implements DB. func (db *PebbleDB) SetSync(key []byte, value []byte) error { - fmt.Println("PebbleDB.SetSync") + //fmt.Println("PebbleDB.SetSync") if len(key) == 0 { return errKeyEmpty } @@ -142,7 +142,7 @@ func (db *PebbleDB) SetSync(key []byte, value []byte) error { // Delete implements DB. func (db *PebbleDB) Delete(key []byte) error { - fmt.Println("PebbleDB.Delete") + //fmt.Println("PebbleDB.Delete") if len(key) == 0 { return errKeyEmpty } @@ -155,7 +155,7 @@ func (db *PebbleDB) Delete(key []byte) error { // DeleteSync implements DB. func (db PebbleDB) DeleteSync(key []byte) error { - fmt.Println("PebbleDB.DeleteSync") + //fmt.Println("PebbleDB.DeleteSync") if len(key) == 0 { return errKeyEmpty } @@ -172,7 +172,7 @@ func (db *PebbleDB) DB() *pebble.DB { // Close implements DB. func (db PebbleDB) Close() error { - fmt.Println("PebbleDB.Close") + //fmt.Println("PebbleDB.Close") db.db.Close() return nil } @@ -211,7 +211,7 @@ func (db *PebbleDB) NewBatch() Batch { // Iterator implements DB. func (db *PebbleDB) Iterator(start, end []byte) (Iterator, error) { - fmt.Println("PebbleDB.Iterator") + //fmt.Println("PebbleDB.Iterator") if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { return nil, errKeyEmpty } @@ -227,7 +227,7 @@ func (db *PebbleDB) Iterator(start, end []byte) (Iterator, error) { // ReverseIterator implements DB. func (db *PebbleDB) ReverseIterator(start, end []byte) (Iterator, error) { - fmt.Println("PebbleDB.ReverseIterator") + //fmt.Println("PebbleDB.ReverseIterator") if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { return nil, errKeyEmpty } @@ -257,7 +257,7 @@ func newPebbleDBBatch(db *PebbleDB) *pebbleDBBatch { // Set implements Batch. func (b *pebbleDBBatch) Set(key, value []byte) error { - fmt.Println("pebbleDBBatch.Set") + //fmt.Println("pebbleDBBatch.Set") if len(key) == 0 { return errKeyEmpty } @@ -273,7 +273,7 @@ func (b *pebbleDBBatch) Set(key, value []byte) error { // Delete implements Batch. func (b *pebbleDBBatch) Delete(key []byte) error { - fmt.Println("pebbleDBBatch.Delete") + //fmt.Println("pebbleDBBatch.Delete") if len(key) == 0 { return errKeyEmpty } @@ -286,7 +286,7 @@ func (b *pebbleDBBatch) Delete(key []byte) error { // Write implements Batch. func (b *pebbleDBBatch) Write() error { - fmt.Println("pebbleDBBatch.Write") + //fmt.Println("pebbleDBBatch.Write") if b.batch == nil { return errBatchClosed } @@ -301,7 +301,7 @@ func (b *pebbleDBBatch) Write() error { // WriteSync implements Batch. func (b *pebbleDBBatch) WriteSync() error { - fmt.Println("pebbleDBBatch.WriteSync") + //fmt.Println("pebbleDBBatch.WriteSync") if b.batch == nil { return errBatchClosed } @@ -315,7 +315,7 @@ func (b *pebbleDBBatch) WriteSync() error { // Close implements Batch. func (b *pebbleDBBatch) Close() error { - fmt.Println("pebbleDBBatch.Close") + //fmt.Println("pebbleDBBatch.Close") if b.batch != nil { err := b.batch.Close() if err != nil { @@ -357,13 +357,13 @@ func newPebbleDBIterator(source *pebble.Iterator, start, end []byte, isReverse b // Domain implements Iterator. func (itr *pebbleDBIterator) Domain() ([]byte, []byte) { - fmt.Println("pebbleDBIterator.Domain") + //fmt.Println("pebbleDBIterator.Domain") return itr.start, itr.end } // Valid implements Iterator. func (itr *pebbleDBIterator) Valid() bool { - fmt.Println("pebbleDBIterator.Valid") + //fmt.Println("pebbleDBIterator.Valid") // Once invalid, forever invalid. if itr.isInvalid { return false @@ -407,21 +407,21 @@ func (itr *pebbleDBIterator) Valid() bool { // Key implements Iterator. func (itr *pebbleDBIterator) Key() []byte { - fmt.Println("pebbleDBIterator.Key") + //fmt.Println("pebbleDBIterator.Key") itr.assertIsValid() return cp(itr.source.Key()) } // Value implements Iterator. func (itr *pebbleDBIterator) Value() []byte { - fmt.Println("pebbleDBIterator.Value") + //fmt.Println("pebbleDBIterator.Value") itr.assertIsValid() return cp(itr.source.Value()) } // Next implements Iterator. func (itr pebbleDBIterator) Next() { - fmt.Println("pebbleDBIterator.Next") + //fmt.Println("pebbleDBIterator.Next") itr.assertIsValid() if itr.isReverse { itr.source.Prev() @@ -437,7 +437,7 @@ func (itr *pebbleDBIterator) Error() error { // Close implements Iterator. func (itr *pebbleDBIterator) Close() error { - fmt.Println("pebbleDBIterator.Close") + //fmt.Println("pebbleDBIterator.Close") err := itr.source.Close() if err != nil { return err From c337ab47381337f0ce7f75e2ba5bbe1e8191082c Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 8 Nov 2022 23:10:29 +0700 Subject: [PATCH 12/26] pebble --- go.mod | 3 +-- go.sum | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 78a34bfca..b2ce26774 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/tendermint/tm-db go 1.19 require ( + github.com/cockroachdb/pebble v0.0.0-20220726134658-7b78c71e4055 github.com/cosmos/gorocksdb v1.2.0 github.com/dgraph-io/badger/v3 v3.2103.2 github.com/gogo/protobuf v1.3.2 @@ -12,8 +13,6 @@ require ( github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca go.etcd.io/bbolt v1.3.6 google.golang.org/grpc v1.48.0 - github.com/cockroachdb/pebble v0.0.0-20220726134658-7b78c71e4055 - github.com/dgraph-io/badger/v3 v3.2103.2 ) require ( diff --git a/go.sum b/go.sum index ffdd56caf..a9b233cc0 100644 --- a/go.sum +++ b/go.sum @@ -55,7 +55,6 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.6.0 h1:DshxFxZWXUcO0xX476VJC07Xsr6ZCBVRHKZ93Oh7Evo= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgraph-io/badger/v3 v3.2103.2 h1:dpyM5eCJAtQCBcMCZcT4UBZchuTJgCywerHHgmxfxM8= github.com/dgraph-io/badger/v3 v3.2103.2/go.mod h1:RHo4/GmYcKKh5Lxu63wLEMHJ70Pac2JqZRYGhlyAo2M= @@ -75,11 +74,8 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA= From 511653cbd8245c91d4976ab98aae3a5caccbf834 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 8 Nov 2022 23:13:20 +0700 Subject: [PATCH 13/26] linting --- .golangci.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 57eae6e4c..38cff43e0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,7 +1,6 @@ linters: disable-all: true enable: - - deadcode - depguard - dogsled - dupl @@ -25,7 +24,6 @@ linters: - revive - unconvert - unused - - varcheck - nolintlint run: @@ -40,10 +38,6 @@ issues: - path: _test\.go linters: - gosec -linters-settings: - maligned: - suggest-new: true - errcheck: - # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; - # default is false: such cases aren't reported by default. - check-blank: true + - text: "leading space" + linters: + - nolintlint From a94a8080c2b2630dcd72941015fe16927728af6d Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 8 Nov 2022 23:18:25 +0700 Subject: [PATCH 14/26] only sane dbs remain. Pebble can consume dbs that were previously rocs. --- badger_db.go | 295 ------ boltdb.go | 204 ---- boltdb_batch.go | 87 -- boltdb_iterator.go | 142 --- boltdb_test.go | 47 - cleveldb.go | 192 ---- cleveldb_batch.go | 82 -- cleveldb_iterator.go | 130 --- cleveldb_test.go | 115 --- go.mod | 20 +- go.sum | 78 -- remotedb/batch.go | 84 -- remotedb/doc.go | 37 - remotedb/grpcdb/client.go | 22 - remotedb/grpcdb/doc.go | 32 - remotedb/grpcdb/example_test.go | 52 - remotedb/grpcdb/server.go | 244 ----- remotedb/iterator.go | 138 --- remotedb/proto/defs.pb.go | 1616 ------------------------------- remotedb/proto/defs.proto | 78 -- remotedb/proto/defspb_test.go | 640 ------------ remotedb/remotedb.go | 123 --- remotedb/remotedb_test.go | 167 ---- remotedb/test.crt | 25 - remotedb/test.key | 27 - rocksdb.go | 187 ---- rocksdb_batch.go | 83 -- rocksdb_iterator.go | 146 --- rocksdb_test.go | 47 - tools/Dockerfile | 44 - 30 files changed, 2 insertions(+), 5182 deletions(-) delete mode 100644 badger_db.go delete mode 100644 boltdb.go delete mode 100644 boltdb_batch.go delete mode 100644 boltdb_iterator.go delete mode 100644 boltdb_test.go delete mode 100644 cleveldb.go delete mode 100644 cleveldb_batch.go delete mode 100644 cleveldb_iterator.go delete mode 100644 cleveldb_test.go delete mode 100644 remotedb/batch.go delete mode 100644 remotedb/doc.go delete mode 100644 remotedb/grpcdb/client.go delete mode 100644 remotedb/grpcdb/doc.go delete mode 100644 remotedb/grpcdb/example_test.go delete mode 100644 remotedb/grpcdb/server.go delete mode 100644 remotedb/iterator.go delete mode 100644 remotedb/proto/defs.pb.go delete mode 100644 remotedb/proto/defs.proto delete mode 100644 remotedb/proto/defspb_test.go delete mode 100644 remotedb/remotedb.go delete mode 100644 remotedb/remotedb_test.go delete mode 100644 remotedb/test.crt delete mode 100644 remotedb/test.key delete mode 100644 rocksdb.go delete mode 100644 rocksdb_batch.go delete mode 100644 rocksdb_iterator.go delete mode 100644 rocksdb_test.go delete mode 100644 tools/Dockerfile diff --git a/badger_db.go b/badger_db.go deleted file mode 100644 index 467ed3361..000000000 --- a/badger_db.go +++ /dev/null @@ -1,295 +0,0 @@ -//go:build badgerdb -// +build badgerdb - -package db - -import ( - "bytes" - "fmt" - "os" - "path/filepath" - - "github.com/dgraph-io/badger/v3" -) - -func init() { registerDBCreator(BadgerDBBackend, badgerDBCreator, true) } - -func badgerDBCreator(dbName, dir string) (DB, error) { - return NewBadgerDB(dbName, dir) -} - -// NewBadgerDB creates a Badger key-value store backed to the -// directory dir supplied. If dir does not exist, it will be created. -func NewBadgerDB(dbName, dir string) (*BadgerDB, error) { - // Since Badger doesn't support database names, we join both to obtain - // the final directory to use for the database. - path := filepath.Join(dir, dbName) - - if err := os.MkdirAll(path, 0o755); err != nil { - return nil, err - } - opts := badger.DefaultOptions(path) - opts.SyncWrites = false // note that we have Sync methods - opts.Logger = nil // badger is too chatty by default - return NewBadgerDBWithOptions(opts) -} - -// NewBadgerDBWithOptions creates a BadgerDB key value store -// gives the flexibility of initializing a database with the -// respective options. -func NewBadgerDBWithOptions(opts badger.Options) (*BadgerDB, error) { - db, err := badger.Open(opts) - if err != nil { - return nil, err - } - return &BadgerDB{db: db}, nil -} - -type BadgerDB struct { - db *badger.DB -} - -var _ DB = (*BadgerDB)(nil) - -func (b *BadgerDB) Get(key []byte) ([]byte, error) { - if len(key) == 0 { - return nil, errKeyEmpty - } - var val []byte - err := b.db.View(func(txn *badger.Txn) error { - item, err := txn.Get(key) - if err == badger.ErrKeyNotFound { - return nil - } else if err != nil { - return err - } - val, err = item.ValueCopy(nil) - if err == nil && val == nil { - val = []byte{} - } - return err - }) - return val, err -} - -func (b *BadgerDB) Has(key []byte) (bool, error) { - if len(key) == 0 { - return false, errKeyEmpty - } - var found bool - err := b.db.View(func(txn *badger.Txn) error { - _, err := txn.Get(key) - if err != nil && err != badger.ErrKeyNotFound { - return err - } - found = (err != badger.ErrKeyNotFound) - return nil - }) - return found, err -} - -func (b *BadgerDB) Set(key, value []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if value == nil { - return errValueNil - } - return b.db.Update(func(txn *badger.Txn) error { - return txn.Set(key, value) - }) -} - -func withSync(db *badger.DB, err error) error { - if err != nil { - return err - } - return db.Sync() -} - -func (b *BadgerDB) SetSync(key, value []byte) error { - return withSync(b.db, b.Set(key, value)) -} - -func (b *BadgerDB) Delete(key []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - return b.db.Update(func(txn *badger.Txn) error { - return txn.Delete(key) - }) -} - -func (b *BadgerDB) DeleteSync(key []byte) error { - return withSync(b.db, b.Delete(key)) -} - -func (b *BadgerDB) Close() error { - return b.db.Close() -} - -func (b *BadgerDB) Print() error { - return nil -} - -func (b *BadgerDB) iteratorOpts(start, end []byte, opts badger.IteratorOptions) (*badgerDBIterator, error) { - if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, errKeyEmpty - } - txn := b.db.NewTransaction(false) - iter := txn.NewIterator(opts) - iter.Rewind() - iter.Seek(start) - if opts.Reverse && iter.Valid() && bytes.Equal(iter.Item().Key(), start) { - // If we're going in reverse, our starting point was "end", - // which is exclusive. - iter.Next() - } - return &badgerDBIterator{ - reverse: opts.Reverse, - start: start, - end: end, - - txn: txn, - iter: iter, - }, nil -} - -func (b *BadgerDB) Iterator(start, end []byte) (Iterator, error) { - opts := badger.DefaultIteratorOptions - return b.iteratorOpts(start, end, opts) -} - -func (b *BadgerDB) ReverseIterator(start, end []byte) (Iterator, error) { - opts := badger.DefaultIteratorOptions - opts.Reverse = true - return b.iteratorOpts(end, start, opts) -} - -func (b *BadgerDB) Stats() map[string]string { - return nil -} - -func (b *BadgerDB) NewBatch() Batch { - wb := &badgerDBBatch{ - db: b.db, - wb: b.db.NewWriteBatch(), - firstFlush: make(chan struct{}, 1), - } - wb.firstFlush <- struct{}{} - return wb -} - -var _ Batch = (*badgerDBBatch)(nil) - -type badgerDBBatch struct { - db *badger.DB - wb *badger.WriteBatch - - // Calling db.Flush twice panics, so we must keep track of whether we've - // flushed already on our own. If Write can receive from the firstFlush - // channel, then it's the first and only Flush call we should do. - // - // Upstream bug report: - // https://github.com/dgraph-io/badger/issues/1394 - firstFlush chan struct{} -} - -func (b *badgerDBBatch) Set(key, value []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if value == nil { - return errValueNil - } - return b.wb.Set(key, value) -} - -func (b *badgerDBBatch) Delete(key []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - return b.wb.Delete(key) -} - -func (b *badgerDBBatch) Write() error { - select { - case <-b.firstFlush: - return b.wb.Flush() - default: - return fmt.Errorf("batch already flushed") - } -} - -func (b *badgerDBBatch) WriteSync() error { - return withSync(b.db, b.Write()) -} - -func (b *badgerDBBatch) Close() error { - select { - case <-b.firstFlush: // a Flush after Cancel panics too - default: - } - b.wb.Cancel() - return nil -} - -type badgerDBIterator struct { - reverse bool - start, end []byte - - txn *badger.Txn - iter *badger.Iterator - - lastErr error -} - -func (i *badgerDBIterator) Close() error { - i.iter.Close() - i.txn.Discard() - return nil -} - -func (i *badgerDBIterator) Domain() (start, end []byte) { return i.start, i.end } -func (i *badgerDBIterator) Error() error { return i.lastErr } - -func (i *badgerDBIterator) Next() { - if !i.Valid() { - panic("iterator is invalid") - } - i.iter.Next() -} - -func (i *badgerDBIterator) Valid() bool { - if !i.iter.Valid() { - return false - } - if len(i.end) > 0 { - key := i.iter.Item().Key() - if c := bytes.Compare(key, i.end); (!i.reverse && c >= 0) || (i.reverse && c < 0) { - // We're at the end key, or past the end. - return false - } - } - return true -} - -func (i *badgerDBIterator) Key() []byte { - if !i.Valid() { - panic("iterator is invalid") - } - // Note that we don't use KeyCopy, so this is only valid until the next - // call to Next. - return i.iter.Item().KeyCopy(nil) -} - -func (i *badgerDBIterator) Value() []byte { - if !i.Valid() { - panic("iterator is invalid") - } - val, err := i.iter.Item().ValueCopy(nil) - if err != nil { - i.lastErr = err - } - return val -} diff --git a/boltdb.go b/boltdb.go deleted file mode 100644 index b1f69983d..000000000 --- a/boltdb.go +++ /dev/null @@ -1,204 +0,0 @@ -//go:build boltdb -// +build boltdb - -package db - -import ( - "errors" - "fmt" - "os" - "path/filepath" - - "go.etcd.io/bbolt" -) - -var bucket = []byte("tm") - -func init() { - registerDBCreator(BoltDBBackend, NewBoltDB, false) -} - -// BoltDB is a wrapper around etcd's fork of bolt (https://github.com/etcd-io/bbolt). -// -// NOTE: All operations (including Set, Delete) are synchronous by default. One -// can globally turn it off by using NoSync config option (not recommended). -// -// A single bucket ([]byte("tm")) is used per a database instance. This could -// lead to performance issues when/if there will be lots of keys. -type BoltDB struct { - db *bbolt.DB -} - -var _ DB = (*BoltDB)(nil) - -// NewBoltDB returns a BoltDB with default options. -func NewBoltDB(name, dir string) (DB, error) { - return NewBoltDBWithOpts(name, dir, bbolt.DefaultOptions) -} - -// NewBoltDBWithOpts allows you to supply *bbolt.Options. ReadOnly: true is not -// supported because NewBoltDBWithOpts creates a global bucket. -func NewBoltDBWithOpts(name string, dir string, opts *bbolt.Options) (DB, error) { - if opts.ReadOnly { - return nil, errors.New("ReadOnly: true is not supported") - } - - dbPath := filepath.Join(dir, name+".db") - db, err := bbolt.Open(dbPath, os.ModePerm, opts) - if err != nil { - return nil, err - } - - // create a global bucket - err = db.Update(func(tx *bbolt.Tx) error { - _, err := tx.CreateBucketIfNotExists(bucket) - return err - }) - if err != nil { - return nil, err - } - - return &BoltDB{db: db}, nil -} - -// Get implements DB. -func (bdb *BoltDB) Get(key []byte) (value []byte, err error) { - if len(key) == 0 { - return nil, errKeyEmpty - } - err = bdb.db.View(func(tx *bbolt.Tx) error { - b := tx.Bucket(bucket) - if v := b.Get(key); v != nil { - value = append([]byte{}, v...) - } - return nil - }) - if err != nil { - return nil, err - } - return -} - -// Has implements DB. -func (bdb *BoltDB) Has(key []byte) (bool, error) { - bytes, err := bdb.Get(key) - if err != nil { - return false, err - } - return bytes != nil, nil -} - -// Set implements DB. -func (bdb *BoltDB) Set(key, value []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if value == nil { - return errValueNil - } - err := bdb.db.Update(func(tx *bbolt.Tx) error { - b := tx.Bucket(bucket) - return b.Put(key, value) - }) - if err != nil { - return err - } - return nil -} - -// SetSync implements DB. -func (bdb *BoltDB) SetSync(key, value []byte) error { - return bdb.Set(key, value) -} - -// Delete implements DB. -func (bdb *BoltDB) Delete(key []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - err := bdb.db.Update(func(tx *bbolt.Tx) error { - return tx.Bucket(bucket).Delete(key) - }) - if err != nil { - return err - } - return nil -} - -// DeleteSync implements DB. -func (bdb *BoltDB) DeleteSync(key []byte) error { - return bdb.Delete(key) -} - -// Close implements DB. -func (bdb *BoltDB) Close() error { - return bdb.db.Close() -} - -// Print implements DB. -// nolint: errcheck -func (bdb *BoltDB) Print() error { - stats := bdb.db.Stats() - fmt.Printf("%v\n", stats) - - err := bdb.db.View(func(tx *bbolt.Tx) error { - tx.Bucket(bucket).ForEach(func(k, v []byte) error { - fmt.Printf("[%X]:\t[%X]\n", k, v) - return nil - }) - return nil - }) - if err != nil { - return err - } - return nil -} - -// Stats implements DB. -func (bdb *BoltDB) Stats() map[string]string { - stats := bdb.db.Stats() - m := make(map[string]string) - - // Freelist stats - m["FreePageN"] = fmt.Sprintf("%v", stats.FreePageN) - m["PendingPageN"] = fmt.Sprintf("%v", stats.PendingPageN) - m["FreeAlloc"] = fmt.Sprintf("%v", stats.FreeAlloc) - m["FreelistInuse"] = fmt.Sprintf("%v", stats.FreelistInuse) - - // Transaction stats - m["TxN"] = fmt.Sprintf("%v", stats.TxN) - m["OpenTxN"] = fmt.Sprintf("%v", stats.OpenTxN) - - return m -} - -// NewBatch implements DB. -func (bdb *BoltDB) NewBatch() Batch { - return newBoltDBBatch(bdb) -} - -// WARNING: Any concurrent writes or reads will block until the iterator is -// closed. -func (bdb *BoltDB) Iterator(start, end []byte) (Iterator, error) { - if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, errKeyEmpty - } - tx, err := bdb.db.Begin(false) - if err != nil { - return nil, err - } - return newBoltDBIterator(tx, start, end, false), nil -} - -// WARNING: Any concurrent writes or reads will block until the iterator is -// closed. -func (bdb *BoltDB) ReverseIterator(start, end []byte) (Iterator, error) { - if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, errKeyEmpty - } - tx, err := bdb.db.Begin(false) - if err != nil { - return nil, err - } - return newBoltDBIterator(tx, start, end, true), nil -} diff --git a/boltdb_batch.go b/boltdb_batch.go deleted file mode 100644 index cd22c6741..000000000 --- a/boltdb_batch.go +++ /dev/null @@ -1,87 +0,0 @@ -//go:build boltdb -// +build boltdb - -package db - -import "go.etcd.io/bbolt" - -// boltDBBatch stores operations internally and dumps them to BoltDB on Write(). -type boltDBBatch struct { - db *BoltDB - ops []operation -} - -var _ Batch = (*boltDBBatch)(nil) - -func newBoltDBBatch(db *BoltDB) *boltDBBatch { - return &boltDBBatch{ - db: db, - ops: []operation{}, - } -} - -// Set implements Batch. -func (b *boltDBBatch) Set(key, value []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if value == nil { - return errValueNil - } - if b.ops == nil { - return errBatchClosed - } - b.ops = append(b.ops, operation{opTypeSet, key, value}) - return nil -} - -// Delete implements Batch. -func (b *boltDBBatch) Delete(key []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if b.ops == nil { - return errBatchClosed - } - b.ops = append(b.ops, operation{opTypeDelete, key, nil}) - return nil -} - -// Write implements Batch. -func (b *boltDBBatch) Write() error { - if b.ops == nil { - return errBatchClosed - } - err := b.db.db.Batch(func(tx *bbolt.Tx) error { - bkt := tx.Bucket(bucket) - for _, op := range b.ops { - switch op.opType { - case opTypeSet: - if err := bkt.Put(op.key, op.value); err != nil { - return err - } - case opTypeDelete: - if err := bkt.Delete(op.key); err != nil { - return err - } - } - } - return nil - }) - if err != nil { - return err - } - // Make sure batch cannot be used afterwards. Callers should still call Close(), for errors. - return b.Close() -} - -// WriteSync implements Batch. -func (b *boltDBBatch) WriteSync() error { - return b.Write() -} - -// Close implements Batch. -func (b *boltDBBatch) Close() error { - b.ops = nil - return nil -} diff --git a/boltdb_iterator.go b/boltdb_iterator.go deleted file mode 100644 index a62e2abb8..000000000 --- a/boltdb_iterator.go +++ /dev/null @@ -1,142 +0,0 @@ -//go:build boltdb -// +build boltdb - -package db - -import ( - "bytes" - - "go.etcd.io/bbolt" -) - -// boltDBIterator allows you to iterate on range of keys/values given some -// start / end keys (nil & nil will result in doing full scan). -type boltDBIterator struct { - tx *bbolt.Tx - - itr *bbolt.Cursor - start []byte - end []byte - - currentKey []byte - currentValue []byte - - isInvalid bool - isReverse bool -} - -var _ Iterator = (*boltDBIterator)(nil) - -// newBoltDBIterator creates a new boltDBIterator. -func newBoltDBIterator(tx *bbolt.Tx, start, end []byte, isReverse bool) *boltDBIterator { - itr := tx.Bucket(bucket).Cursor() - - var ck, cv []byte - if isReverse { - switch { - case end == nil: - ck, cv = itr.Last() - default: - _, _ = itr.Seek(end) // after key - ck, cv = itr.Prev() // return to end key - } - } else { - switch { - case start == nil: - ck, cv = itr.First() - default: - ck, cv = itr.Seek(start) - } - } - - return &boltDBIterator{ - tx: tx, - itr: itr, - start: start, - end: end, - currentKey: ck, - currentValue: cv, - isReverse: isReverse, - isInvalid: false, - } -} - -// Domain implements Iterator. -func (itr *boltDBIterator) Domain() ([]byte, []byte) { - return itr.start, itr.end -} - -// Valid implements Iterator. -func (itr *boltDBIterator) Valid() bool { - if itr.isInvalid { - return false - } - - if itr.Error() != nil { - itr.isInvalid = true - return false - } - - // iterated to the end of the cursor - if itr.currentKey == nil { - itr.isInvalid = true - return false - } - - if itr.isReverse { - if itr.start != nil && bytes.Compare(itr.currentKey, itr.start) < 0 { - itr.isInvalid = true - return false - } - } else { - if itr.end != nil && bytes.Compare(itr.end, itr.currentKey) <= 0 { - itr.isInvalid = true - return false - } - } - - // Valid - return true -} - -// Next implements Iterator. -func (itr *boltDBIterator) Next() { - itr.assertIsValid() - if itr.isReverse { - itr.currentKey, itr.currentValue = itr.itr.Prev() - } else { - itr.currentKey, itr.currentValue = itr.itr.Next() - } -} - -// Key implements Iterator. -func (itr *boltDBIterator) Key() []byte { - itr.assertIsValid() - return append([]byte{}, itr.currentKey...) -} - -// Value implements Iterator. -func (itr *boltDBIterator) Value() []byte { - itr.assertIsValid() - var value []byte - if itr.currentValue != nil { - value = append([]byte{}, itr.currentValue...) - } - return value -} - -// Error implements Iterator. -func (itr *boltDBIterator) Error() error { - return nil -} - -// Close implements Iterator. -func (itr *boltDBIterator) Close() error { - return itr.tx.Rollback() -} - -func (itr *boltDBIterator) assertIsValid() { - if !itr.Valid() { - panic("iterator is invalid") - } -} diff --git a/boltdb_test.go b/boltdb_test.go deleted file mode 100644 index 02a9eaf44..000000000 --- a/boltdb_test.go +++ /dev/null @@ -1,47 +0,0 @@ -//go:build boltdb -// +build boltdb - -package db - -import ( - "fmt" - "os" - "path/filepath" - "testing" - - "github.com/stretchr/testify/require" -) - -func TestBoltDBNewBoltDB(t *testing.T) { - name := fmt.Sprintf("test_%x", randStr(12)) - dir := os.TempDir() - defer cleanupDBDir(dir, name) - - db, err := NewBoltDB(name, dir) - require.NoError(t, err) - db.Close() -} - -func TestWithBoltDB(t *testing.T) { - dir := t.TempDir() - path := filepath.Join(dir, "boltdb") - - db, err := NewBoltDB(path, "") - require.NoError(t, err) - - t.Run("BoltDB", func(t *testing.T) { Run(t, db) }) -} - -func BenchmarkBoltDBRandomReadsWrites(b *testing.B) { - name := fmt.Sprintf("test_%x", randStr(12)) - db, err := NewBoltDB(name, "") - if err != nil { - b.Fatal(err) - } - defer func() { - db.Close() - cleanupDBDir("", name) - }() - - benchmarkRandomReadsWrites(b, db) -} diff --git a/cleveldb.go b/cleveldb.go deleted file mode 100644 index a4b467aad..000000000 --- a/cleveldb.go +++ /dev/null @@ -1,192 +0,0 @@ -//go:build cleveldb -// +build cleveldb - -package db - -import ( - "fmt" - "path/filepath" - - "github.com/jmhodges/levigo" -) - -func init() { - dbCreator := func(name string, dir string) (DB, error) { - return NewCLevelDB(name, dir) - } - registerDBCreator(CLevelDBBackend, dbCreator, false) -} - -// CLevelDB uses the C LevelDB database via a Go wrapper. -type CLevelDB struct { - db *levigo.DB - ro *levigo.ReadOptions - wo *levigo.WriteOptions - woSync *levigo.WriteOptions -} - -var _ DB = (*CLevelDB)(nil) - -// NewCLevelDB creates a new CLevelDB. -func NewCLevelDB(name string, dir string) (*CLevelDB, error) { - dbPath := filepath.Join(dir, name+".db") - - opts := levigo.NewOptions() - opts.SetCache(levigo.NewLRUCache(1 << 30)) - opts.SetCreateIfMissing(true) - db, err := levigo.Open(dbPath, opts) - if err != nil { - return nil, err - } - ro := levigo.NewReadOptions() - wo := levigo.NewWriteOptions() - woSync := levigo.NewWriteOptions() - woSync.SetSync(true) - database := &CLevelDB{ - db: db, - ro: ro, - wo: wo, - woSync: woSync, - } - return database, nil -} - -// Get implements DB. -func (db *CLevelDB) Get(key []byte) ([]byte, error) { - if len(key) == 0 { - return nil, errKeyEmpty - } - res, err := db.db.Get(db.ro, key) - if err != nil { - return nil, err - } - return res, nil -} - -// Has implements DB. -func (db *CLevelDB) Has(key []byte) (bool, error) { - bytes, err := db.Get(key) - if err != nil { - return false, err - } - return bytes != nil, nil -} - -// Set implements DB. -func (db *CLevelDB) Set(key []byte, value []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if value == nil { - return errValueNil - } - if err := db.db.Put(db.wo, key, value); err != nil { - return err - } - return nil -} - -// SetSync implements DB. -func (db *CLevelDB) SetSync(key []byte, value []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if value == nil { - return errValueNil - } - if err := db.db.Put(db.woSync, key, value); err != nil { - return err - } - return nil -} - -// Delete implements DB. -func (db *CLevelDB) Delete(key []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if err := db.db.Delete(db.wo, key); err != nil { - return err - } - return nil -} - -// DeleteSync implements DB. -func (db *CLevelDB) DeleteSync(key []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if err := db.db.Delete(db.woSync, key); err != nil { - return err - } - return nil -} - -// FIXME This should not be exposed -func (db *CLevelDB) DB() *levigo.DB { - return db.db -} - -// Close implements DB. -func (db *CLevelDB) Close() error { - db.db.Close() - db.ro.Close() - db.wo.Close() - db.woSync.Close() - return nil -} - -// Print implements DB. -func (db *CLevelDB) Print() error { - itr, err := db.Iterator(nil, nil) - if err != nil { - return err - } - defer itr.Close() - for ; itr.Valid(); itr.Next() { - key := itr.Key() - value := itr.Value() - fmt.Printf("[%X]:\t[%X]\n", key, value) - } - return nil -} - -// Stats implements DB. -func (db *CLevelDB) Stats() map[string]string { - keys := []string{ - "leveldb.num-files-at-level{n}", - "leveldb.sstables", - "leveldb.stats", - "leveldb.approximate-memory-usage", - } - - stats := make(map[string]string, len(keys)) - for _, key := range keys { - str := db.db.PropertyValue(key) - stats[key] = str - } - return stats -} - -// NewBatch implements DB. -func (db *CLevelDB) NewBatch() Batch { - return newCLevelDBBatch(db) -} - -// Iterator implements DB. -func (db *CLevelDB) Iterator(start, end []byte) (Iterator, error) { - if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, errKeyEmpty - } - itr := db.db.NewIterator(db.ro) - return newCLevelDBIterator(itr, start, end, false), nil -} - -// ReverseIterator implements DB. -func (db *CLevelDB) ReverseIterator(start, end []byte) (Iterator, error) { - if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, errKeyEmpty - } - itr := db.db.NewIterator(db.ro) - return newCLevelDBIterator(itr, start, end, true), nil -} diff --git a/cleveldb_batch.go b/cleveldb_batch.go deleted file mode 100644 index b77bd523d..000000000 --- a/cleveldb_batch.go +++ /dev/null @@ -1,82 +0,0 @@ -//go:build cleveldb -// +build cleveldb - -package db - -import "github.com/jmhodges/levigo" - -// cLevelDBBatch is a LevelDB batch. -type cLevelDBBatch struct { - db *CLevelDB - batch *levigo.WriteBatch -} - -func newCLevelDBBatch(db *CLevelDB) *cLevelDBBatch { - return &cLevelDBBatch{ - db: db, - batch: levigo.NewWriteBatch(), - } -} - -// Set implements Batch. -func (b *cLevelDBBatch) Set(key, value []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if value == nil { - return errValueNil - } - if b.batch == nil { - return errBatchClosed - } - b.batch.Put(key, value) - return nil -} - -// Delete implements Batch. -func (b *cLevelDBBatch) Delete(key []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if b.batch == nil { - return errBatchClosed - } - b.batch.Delete(key) - return nil -} - -// Write implements Batch. -func (b *cLevelDBBatch) Write() error { - if b.batch == nil { - return errBatchClosed - } - err := b.db.db.Write(b.db.wo, b.batch) - if err != nil { - return err - } - // Make sure batch cannot be used afterwards. Callers should still call Close(), for errors. - return b.Close() -} - -// WriteSync implements Batch. -func (b *cLevelDBBatch) WriteSync() error { - if b.batch == nil { - return errBatchClosed - } - err := b.db.db.Write(b.db.woSync, b.batch) - if err != nil { - return err - } - // Make sure batch cannot be used afterwards. Callers should still call Close(), for errors. - b.Close() - return nil -} - -// Close implements Batch. -func (b *cLevelDBBatch) Close() error { - if b.batch != nil { - b.batch.Close() - b.batch = nil - } - return nil -} diff --git a/cleveldb_iterator.go b/cleveldb_iterator.go deleted file mode 100644 index 5a7f1e6ad..000000000 --- a/cleveldb_iterator.go +++ /dev/null @@ -1,130 +0,0 @@ -//go:build cleveldb -// +build cleveldb - -package db - -import ( - "bytes" - - "github.com/jmhodges/levigo" -) - -// cLevelDBIterator is a cLevelDB iterator. -type cLevelDBIterator struct { - source *levigo.Iterator - start, end []byte - isReverse bool - isInvalid bool -} - -var _ Iterator = (*cLevelDBIterator)(nil) - -func newCLevelDBIterator(source *levigo.Iterator, start, end []byte, isReverse bool) *cLevelDBIterator { - if isReverse { - if len(end) == 0 { - source.SeekToLast() - } else { - source.Seek(end) - if source.Valid() { - eoakey := source.Key() // end or after key - if bytes.Compare(end, eoakey) <= 0 { - source.Prev() - } - } else { - source.SeekToLast() - } - } - } else { - if len(start) == 0 { - source.SeekToFirst() - } else { - source.Seek(start) - } - } - return &cLevelDBIterator{ - source: source, - start: start, - end: end, - isReverse: isReverse, - isInvalid: false, - } -} - -// Domain implements Iterator. -func (itr cLevelDBIterator) Domain() ([]byte, []byte) { - return itr.start, itr.end -} - -// Valid implements Iterator. -func (itr cLevelDBIterator) Valid() bool { - // Once invalid, forever invalid. - if itr.isInvalid { - return false - } - - // If source errors, invalid. - if itr.source.GetError() != nil { - return false - } - - // If source is invalid, invalid. - if !itr.source.Valid() { - return false - } - - // If key is end or past it, invalid. - start := itr.start - end := itr.end - key := itr.source.Key() - if itr.isReverse { - if start != nil && bytes.Compare(key, start) < 0 { - return false - } - } else { - if end != nil && bytes.Compare(end, key) <= 0 { - return false - } - } - - // It's valid. - return true -} - -// Key implements Iterator. -func (itr cLevelDBIterator) Key() []byte { - itr.assertIsValid() - return itr.source.Key() -} - -// Value implements Iterator. -func (itr cLevelDBIterator) Value() []byte { - itr.assertIsValid() - return itr.source.Value() -} - -// Next implements Iterator. -func (itr cLevelDBIterator) Next() { - itr.assertIsValid() - if itr.isReverse { - itr.source.Prev() - } else { - itr.source.Next() - } -} - -// Error implements Iterator. -func (itr cLevelDBIterator) Error() error { - return itr.source.GetError() -} - -// Close implements Iterator. -func (itr cLevelDBIterator) Close() error { - itr.source.Close() - return nil -} - -func (itr cLevelDBIterator) assertIsValid() { - if !itr.Valid() { - panic("iterator is invalid") - } -} diff --git a/cleveldb_test.go b/cleveldb_test.go deleted file mode 100644 index 8e419d246..000000000 --- a/cleveldb_test.go +++ /dev/null @@ -1,115 +0,0 @@ -//go:build cleveldb -// +build cleveldb - -package db - -import ( - "bytes" - "fmt" - "math/rand" - "os" - "path/filepath" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestWithClevelDB(t *testing.T) { - dir := t.TempDir() - path := filepath.Join(dir, "cleveldb") - - db, err := NewCLevelDB(path, "") - require.NoError(t, err) - - t.Run("ClevelDB", func(t *testing.T) { Run(t, db) }) -} - -// nolint: errcheck -func BenchmarkRandomReadsWrites2(b *testing.B) { - b.StopTimer() - - numItems := int64(1000000) - internal := map[int64]int64{} - for i := 0; i < int(numItems); i++ { - internal[int64(i)] = int64(0) - } - db, err := NewCLevelDB(fmt.Sprintf("test_%x", randStr(12)), "") - if err != nil { - b.Fatal(err.Error()) - return - } - - fmt.Println("ok, starting") - b.StartTimer() - - for i := 0; i < b.N; i++ { - // Write something - { - idx := (int64(rand.Int()) % numItems) - internal[idx]++ - val := internal[idx] - idxBytes := int642Bytes(idx) - valBytes := int642Bytes(val) - db.Set( - idxBytes, - valBytes, - ) - } - // Read something - { - idx := (int64(rand.Int()) % numItems) - val := internal[idx] - idxBytes := int642Bytes(idx) - valBytes, err := db.Get(idxBytes) - if err != nil { - b.Error(err) - } - // fmt.Printf("Get %X -> %X\n", idxBytes, valBytes) - if val == 0 { - if !bytes.Equal(valBytes, nil) { - b.Errorf("Expected %v for %v, got %X", - nil, idx, valBytes) - break - } - } else { - if len(valBytes) != 8 { - b.Errorf("Expected length 8 for %v, got %X", - idx, valBytes) - break - } - valGot := bytes2Int64(valBytes) - if val != valGot { - b.Errorf("Expected %v for %v, got %v", - val, idx, valGot) - break - } - } - } - } - - db.Close() -} - -func TestCLevelDBBackend(t *testing.T) { - name := fmt.Sprintf("test_%x", randStr(12)) - // Can't use "" (current directory) or "./" here because levigo.Open returns: - // "Error initializing DB: IO error: test_XXX.db: Invalid argument" - dir := os.TempDir() - db, err := NewDB(name, CLevelDBBackend, dir) - require.NoError(t, err) - defer cleanupDBDir(dir, name) - - _, ok := db.(*CLevelDB) - assert.True(t, ok) -} - -func TestCLevelDBStats(t *testing.T) { - name := fmt.Sprintf("test_%x", randStr(12)) - dir := os.TempDir() - db, err := NewDB(name, CLevelDBBackend, dir) - require.NoError(t, err) - defer cleanupDBDir(dir, name) - - assert.NotEmpty(t, db.Stats()) -} diff --git a/go.mod b/go.mod index b2ce26774..c4b1b0e40 100644 --- a/go.mod +++ b/go.mod @@ -4,46 +4,30 @@ go 1.19 require ( github.com/cockroachdb/pebble v0.0.0-20220726134658-7b78c71e4055 - github.com/cosmos/gorocksdb v1.2.0 - github.com/dgraph-io/badger/v3 v3.2103.2 - github.com/gogo/protobuf v1.3.2 github.com/google/btree v1.1.2 - github.com/jmhodges/levigo v1.0.0 github.com/stretchr/testify v1.8.0 github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca - go.etcd.io/bbolt v1.3.6 - google.golang.org/grpc v1.48.0 ) require ( github.com/DataDog/zstd v1.4.5 // indirect github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect - github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.1.1 // indirect github.com/cockroachdb/errors v1.8.1 // indirect github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f // indirect github.com/cockroachdb/redact v1.0.8 // indirect github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/dgraph-io/ristretto v0.1.0 // indirect - github.com/dustin/go-humanize v1.0.0 // indirect - github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect - github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.3 // indirect - github.com/google/flatbuffers v1.12.1 // indirect + github.com/google/go-cmp v0.5.6 // indirect github.com/klauspost/compress v1.12.3 // indirect github.com/kr/pretty v0.1.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opencensus.io v0.22.5 // indirect golang.org/x/exp v0.0.0-20200513190911-00229845015e // indirect - golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 // indirect - golang.org/x/text v0.3.3 // indirect - google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect - google.golang.org/protobuf v1.27.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index a9b233cc0..acb259901 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,4 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -12,26 +11,16 @@ github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7/go.mod h1:6E6s8o2AE4KhCrqr6GRJjdC/gNfTdxkIXvuGZZda2VM= -github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v1.0.0/go.mod h1:5Ib8Meh+jk1RlHIXej6Pzevx/NLlNvQB9pmSBZErGA4= github.com/cockroachdb/errors v1.6.1/go.mod h1:tm6FTP5G81vwJ5lC0SizQo374JNCOPrHyXGitRJoDqM= github.com/cockroachdb/errors v1.8.1 h1:A5+txlVZfOqFBDa4mGz2bUWSp0aHElvHX2bKkdbQu+Y= @@ -48,34 +37,20 @@ github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcju github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= -github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= -github.com/dgraph-io/badger/v3 v3.2103.2 h1:dpyM5eCJAtQCBcMCZcT4UBZchuTJgCywerHHgmxfxM8= -github.com/dgraph-io/badger/v3 v3.2103.2/go.mod h1:RHo4/GmYcKKh5Lxu63wLEMHJ70Pac2JqZRYGhlyAo2M= -github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI= -github.com/dgraph-io/ristretto v0.1.0/go.mod h1:fux0lOrBhrVCJd3lcTHsIJhq1T2rokOu6v9Vcb3Q9ug= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA= @@ -85,7 +60,6 @@ github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= @@ -104,10 +78,7 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -118,34 +89,23 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= -github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= @@ -157,8 +117,6 @@ github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbk github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= github.com/iris-contrib/i18n v0.0.0-20171121225848-987a633949d0/go.mod h1:pMCz62A0xJL6I+umB2YTlFRwWXaDFA0jy+5HzGiJjqI= github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= -github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= -github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= @@ -225,7 +183,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= @@ -233,9 +190,6 @@ github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNX github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= @@ -247,7 +201,6 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= @@ -271,11 +224,6 @@ github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDf github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= -go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= -go.opencensus.io v0.22.5 h1:dntmOdLpSpHlVqbW5Eay97DelsZHe+55D+xC6i0dDS0= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -306,7 +254,6 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -317,14 +264,11 @@ golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -337,7 +281,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -347,10 +290,7 @@ golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210909193231-528a39cd75f3/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 h1:nhht2DYV/Sn3qOayu8lM+cU1ii9sTLUeBQwQQfUHtrs= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -388,35 +328,18 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w= -google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= @@ -428,7 +351,6 @@ gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3M gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/remotedb/batch.go b/remotedb/batch.go deleted file mode 100644 index fe2becb14..000000000 --- a/remotedb/batch.go +++ /dev/null @@ -1,84 +0,0 @@ -package remotedb - -import ( - "errors" - "fmt" - - db "github.com/tendermint/tm-db" - protodb "github.com/tendermint/tm-db/remotedb/proto" -) - -var errBatchClosed = errors.New("batch has been written or closed") - -type batch struct { - db *RemoteDB - ops []*protodb.Operation -} - -var _ db.Batch = (*batch)(nil) - -func newBatch(rdb *RemoteDB) *batch { - return &batch{ - db: rdb, - ops: []*protodb.Operation{}, - } -} - -// Set implements Batch. -func (b *batch) Set(key, value []byte) error { - if b.ops == nil { - return errBatchClosed - } - op := &protodb.Operation{ - Entity: &protodb.Entity{Key: key, Value: value}, - Type: protodb.Operation_SET, - } - b.ops = append(b.ops, op) - return nil -} - -// Delete implements Batch. -func (b *batch) Delete(key []byte) error { - if b.ops == nil { - return errBatchClosed - } - op := &protodb.Operation{ - Entity: &protodb.Entity{Key: key}, - Type: protodb.Operation_DELETE, - } - b.ops = append(b.ops, op) - return nil -} - -// Write implements Batch. -func (b *batch) Write() error { - if b.ops == nil { - return errBatchClosed - } - _, err := b.db.dc.BatchWrite(b.db.ctx, &protodb.Batch{Ops: b.ops}) - if err != nil { - return fmt.Errorf("remoteDB.BatchWrite: %w", err) - } - // Make sure batch cannot be used afterwards. Callers should still call Close(), for errors. - b.Close() - return nil -} - -// WriteSync implements Batch. -func (b *batch) WriteSync() error { - if b.ops == nil { - return errBatchClosed - } - _, err := b.db.dc.BatchWriteSync(b.db.ctx, &protodb.Batch{Ops: b.ops}) - if err != nil { - return fmt.Errorf("RemoteDB.BatchWriteSync: %w", err) - } - // Make sure batch cannot be used afterwards. Callers should still call Close(), for errors. - return b.Close() -} - -// Close implements Batch. -func (b *batch) Close() error { - b.ops = nil - return nil -} diff --git a/remotedb/doc.go b/remotedb/doc.go deleted file mode 100644 index 93d9c8a29..000000000 --- a/remotedb/doc.go +++ /dev/null @@ -1,37 +0,0 @@ -/* -remotedb is a package for connecting to distributed Tendermint db.DB -instances. The purpose is to detach difficult deployments such as -CLevelDB that requires gcc or perhaps for databases that require -custom configurations such as extra disk space. It also eases -the burden and cost of deployment of dependencies for databases -to be used by Tendermint developers. Most importantly it is built -over the high performant gRPC transport. - -remotedb's RemoteDB implements db.DB so can be used normally -like other databases. One just has to explicitly connect to the -remote database with a client setup such as: - - client, err := remotedb.NewRemoteDB(addr, cert) - // Make sure to invoke InitRemote! - if err := client.InitRemote(&remotedb.Init{Name: "test-remote-db", Type: "leveldb"}); err != nil { - log.Fatalf("Failed to initialize the remote db") - } - - client.Set(key1, value) - gv1 := client.SetSync(k2, v2) - - client.Delete(k1) - gv2 := client.Get(k1) - - for itr := client.Iterator(k1, k9); itr.Valid(); itr.Next() { - ik, iv := itr.Key(), itr.Value() - ds, de := itr.Domain() - } - - stats := client.Stats() - - if !client.Has(dk1) { - client.SetSync(dk1, dv1) - } -*/ -package remotedb diff --git a/remotedb/grpcdb/client.go b/remotedb/grpcdb/client.go deleted file mode 100644 index afe9b65e5..000000000 --- a/remotedb/grpcdb/client.go +++ /dev/null @@ -1,22 +0,0 @@ -package grpcdb - -import ( - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - - protodb "github.com/tendermint/tm-db/remotedb/proto" -) - -// NewClient creates a gRPC client connected to the bound gRPC server at serverAddr. -// Use kind to set the level of security to either Secure or Insecure. -func NewClient(serverAddr, serverCert string) (protodb.DBClient, error) { - creds, err := credentials.NewClientTLSFromFile(serverCert, "") - if err != nil { - return nil, err - } - cc, err := grpc.Dial(serverAddr, grpc.WithTransportCredentials(creds)) - if err != nil { - return nil, err - } - return protodb.NewDBClient(cc), nil -} diff --git a/remotedb/grpcdb/doc.go b/remotedb/grpcdb/doc.go deleted file mode 100644 index 0d8e380ce..000000000 --- a/remotedb/grpcdb/doc.go +++ /dev/null @@ -1,32 +0,0 @@ -/* -grpcdb is the distribution of Tendermint's db.DB instances using -the gRPC transport to decouple local db.DB usages from applications, -to using them over a network in a highly performant manner. - -grpcdb allows users to initialize a database's server like -they would locally and invoke the respective methods of db.DB. - -Most users shouldn't use this package, but should instead use -remotedb. Only the lower level users and database server deployers -should use it, for functionality such as: - - ln, err := net.Listen("tcp", "0.0.0.0:0") - srv := grpcdb.NewServer() - defer srv.Stop() - go func() { - if err := srv.Serve(ln); err != nil { - t.Fatalf("BindServer: %v", err) - } - }() - -or - addr := ":8998" - cert := "server.crt" - key := "server.key" - go func() { - if err := grpcdb.ListenAndServe(addr, cert, key); err != nil { - log.Fatalf("BindServer: %v", err) - } - }() -*/ -package grpcdb diff --git a/remotedb/grpcdb/example_test.go b/remotedb/grpcdb/example_test.go deleted file mode 100644 index 1e93c88ed..000000000 --- a/remotedb/grpcdb/example_test.go +++ /dev/null @@ -1,52 +0,0 @@ -package grpcdb_test - -import ( - "bytes" - "context" - "log" - - grpcdb "github.com/tendermint/tm-db/remotedb/grpcdb" - protodb "github.com/tendermint/tm-db/remotedb/proto" -) - -func Example() { - addr := ":8998" - cert := "server.crt" - key := "server.key" - go func() { - if err := grpcdb.ListenAndServe(addr, cert, key); err != nil { - log.Fatalf("BindServer: %v", err) - } - }() - - client, err := grpcdb.NewClient(addr, cert) - if err != nil { - log.Fatalf("Failed to create grpcDB client: %v", err) - } - - ctx := context.Background() - // 1. Initialize the DB - in := &protodb.Init{ - Type: "leveldb", - Name: "grpc-uno-test", - Dir: ".", - } - if _, err := client.Init(ctx, in); err != nil { - log.Fatalf("Init error: %v", err) - } - - // 2. Now it can be used! - query1 := &protodb.Entity{Key: []byte("Project"), Value: []byte("Tmlibs-on-gRPC")} - if _, err := client.SetSync(ctx, query1); err != nil { - log.Fatalf("SetSync err: %v", err) - } - - query2 := &protodb.Entity{Key: []byte("Project")} - read, err := client.Get(ctx, query2) - if err != nil { - log.Fatalf("Get err: %v", err) - } - if g, w := read.Value, []byte("Tmlibs-on-gRPC"); !bytes.Equal(g, w) { - log.Fatalf("got= (%q ==> % X)\nwant=(%q ==> % X)", g, g, w, w) - } -} diff --git a/remotedb/grpcdb/server.go b/remotedb/grpcdb/server.go deleted file mode 100644 index 3cedca8c7..000000000 --- a/remotedb/grpcdb/server.go +++ /dev/null @@ -1,244 +0,0 @@ -package grpcdb - -import ( - "context" - "net" - "sync" - "time" - - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - - db "github.com/tendermint/tm-db" - protodb "github.com/tendermint/tm-db/remotedb/proto" -) - -// ListenAndServe is a blocking function that sets up a gRPC based -// server at the address supplied, with the gRPC options passed in. -// Normally in usage, invoke it in a goroutine like you would for http.ListenAndServe. -func ListenAndServe(addr, cert, key string, opts ...grpc.ServerOption) error { - ln, err := net.Listen("tcp", addr) - if err != nil { - return err - } - srv, err := NewServer(cert, key, opts...) - if err != nil { - return err - } - return srv.Serve(ln) -} - -func NewServer(cert, key string, opts ...grpc.ServerOption) (*grpc.Server, error) { - creds, err := credentials.NewServerTLSFromFile(cert, key) - if err != nil { - return nil, err - } - opts = append(opts, grpc.Creds(creds)) - srv := grpc.NewServer(opts...) - protodb.RegisterDBServer(srv, new(server)) - return srv, nil -} - -type server struct { - mu sync.Mutex - db db.DB -} - -var _ protodb.DBServer = (*server)(nil) - -// Init initializes the server's database. Only one type of database -// can be initialized per server. -// -// Dir is the directory on the file system in which the DB will be stored(if backed by disk) (TODO: remove) -// -// Name is representative filesystem entry's basepath -// -// Type can be either one of: -// * cleveldb (if built with gcc enabled) -// * fsdb -// * memdB -// * goleveldb -// See https://godoc.org/github.com/tendermint/tendermint/libs/db#BackendType -func (s *server) Init(ctx context.Context, in *protodb.Init) (*protodb.Entity, error) { - s.mu.Lock() - defer s.mu.Unlock() - - var err error - s.db, err = db.NewDB(in.Name, db.BackendType(in.Type), in.Dir) - if err != nil { - return nil, err - } - return &protodb.Entity{CreatedAt: time.Now().Unix()}, nil -} - -func (s *server) Delete(ctx context.Context, in *protodb.Entity) (*protodb.Nothing, error) { - err := s.db.Delete(in.Key) - if err != nil { - return nil, err - } - return nothing, nil -} - -var nothing = new(protodb.Nothing) - -func (s *server) DeleteSync(ctx context.Context, in *protodb.Entity) (*protodb.Nothing, error) { - err := s.db.DeleteSync(in.Key) - if err != nil { - return nil, err - } - return nothing, nil -} - -func (s *server) Get(ctx context.Context, in *protodb.Entity) (*protodb.Entity, error) { - value, err := s.db.Get(in.Key) - if err != nil { - return nil, err - } - return &protodb.Entity{Value: value}, nil -} - -func (s *server) GetStream(ds protodb.DB_GetStreamServer) error { - // Receive routine - responsesChan := make(chan *protodb.Entity) - go func() { - defer close(responsesChan) - ctx := context.Background() - for { - in, err := ds.Recv() - if err != nil { - responsesChan <- &protodb.Entity{Err: err.Error()} - return - } - out, err := s.Get(ctx, in) - if err != nil { - if out == nil { - out = new(protodb.Entity) - out.Key = in.Key - } - out.Err = err.Error() - responsesChan <- out - return - } - - // Otherwise continue on - responsesChan <- out - } - }() - - // Send routine, block until we return - for out := range responsesChan { - if err := ds.Send(out); err != nil { - return err - } - } - return nil -} - -func (s *server) Has(ctx context.Context, in *protodb.Entity) (*protodb.Entity, error) { - exists, err := s.db.Has(in.Key) - if err != nil { - return nil, err - } - return &protodb.Entity{Exists: exists}, nil -} - -func (s *server) Set(ctx context.Context, in *protodb.Entity) (*protodb.Nothing, error) { - err := s.db.Set(in.Key, in.Value) - if err != nil { - return nil, err - } - return nothing, nil -} - -func (s *server) SetSync(ctx context.Context, in *protodb.Entity) (*protodb.Nothing, error) { - err := s.db.SetSync(in.Key, in.Value) - if err != nil { - return nil, err - } - return nothing, nil -} - -func (s *server) Iterator(query *protodb.Entity, dis protodb.DB_IteratorServer) error { - it, err := s.db.Iterator(query.Start, query.End) - if err != nil { - return err - } - defer it.Close() - return s.handleIterator(it, dis.Send) -} - -func (s *server) handleIterator(it db.Iterator, sendFunc func(*protodb.Iterator) error) error { - for it.Valid() { - start, end := it.Domain() - key := it.Key() - value := it.Value() - - out := &protodb.Iterator{ - Domain: &protodb.Domain{Start: start, End: end}, - Valid: it.Valid(), - Key: key, - Value: value, - } - if err := sendFunc(out); err != nil { - return err - } - - // Finally move the iterator forward, - it.Next() - - } - return nil -} - -func (s *server) ReverseIterator(query *protodb.Entity, dis protodb.DB_ReverseIteratorServer) error { - it, err := s.db.ReverseIterator(query.Start, query.End) - if err != nil { - return err - } - defer it.Close() - return s.handleIterator(it, dis.Send) -} - -func (s *server) Stats(context.Context, *protodb.Nothing) (*protodb.Stats, error) { - stats := s.db.Stats() - return &protodb.Stats{Data: stats, TimeAt: time.Now().Unix()}, nil -} - -func (s *server) BatchWrite(c context.Context, b *protodb.Batch) (*protodb.Nothing, error) { - return s.batchWrite(c, b, false) -} - -func (s *server) BatchWriteSync(c context.Context, b *protodb.Batch) (*protodb.Nothing, error) { - return s.batchWrite(c, b, true) -} - -func (s *server) batchWrite(c context.Context, b *protodb.Batch, sync bool) (*protodb.Nothing, error) { - bat := s.db.NewBatch() - defer bat.Close() - for _, op := range b.Ops { - switch op.Type { - case protodb.Operation_SET: - err := bat.Set(op.Entity.Key, op.Entity.Value) - if err != nil { - return nil, err - } - case protodb.Operation_DELETE: - err := bat.Delete(op.Entity.Key) - if err != nil { - return nil, err - } - } - } - if sync { - err := bat.WriteSync() - if err != nil { - return nil, err - } - } else { - err := bat.Write() - if err != nil { - return nil, err - } - } - return nothing, nil -} diff --git a/remotedb/iterator.go b/remotedb/iterator.go deleted file mode 100644 index 325dc5386..000000000 --- a/remotedb/iterator.go +++ /dev/null @@ -1,138 +0,0 @@ -package remotedb - -import ( - db "github.com/tendermint/tm-db" - protodb "github.com/tendermint/tm-db/remotedb/proto" -) - -func makeIterator(dic protodb.DB_IteratorClient) db.Iterator { - itr := &iterator{dic: dic} - itr.Next() // We need to call Next to prime the iterator - return itr -} - -func makeReverseIterator(dric protodb.DB_ReverseIteratorClient) db.Iterator { - rItr := &reverseIterator{dric: dric} - rItr.Next() // We need to call Next to prime the iterator - return rItr -} - -type reverseIterator struct { - dric protodb.DB_ReverseIteratorClient - cur *protodb.Iterator - err error -} - -var _ db.Iterator = (*iterator)(nil) - -// Valid implements Iterator. -func (rItr *reverseIterator) Valid() bool { - return rItr.cur != nil && rItr.cur.Valid && rItr.err == nil -} - -// Domain implements Iterator. -func (rItr *reverseIterator) Domain() (start, end []byte) { - if rItr.cur == nil || rItr.cur.Domain == nil { - return nil, nil - } - return rItr.cur.Domain.Start, rItr.cur.Domain.End -} - -// Next implements Iterator. -func (rItr *reverseIterator) Next() { - var err error - rItr.cur, err = rItr.dric.Recv() - if err != nil { - rItr.err = err - } -} - -// Key implements Iterator. -func (rItr *reverseIterator) Key() []byte { - rItr.assertIsValid() - return rItr.cur.Key -} - -// Value implements Iterator. -func (rItr *reverseIterator) Value() []byte { - rItr.assertIsValid() - return rItr.cur.Value -} - -// Error implements Iterator. -func (rItr *reverseIterator) Error() error { - return rItr.err -} - -// Close implements Iterator. -func (rItr *reverseIterator) Close() error { - return nil -} - -func (rItr *reverseIterator) assertIsValid() { - if !rItr.Valid() { - panic("iterator is invalid") - } -} - -// iterator implements the db.Iterator by retrieving -// streamed iterators from the remote backend as -// needed. It is NOT safe for concurrent usage, -// matching the behavior of other iterators. -type iterator struct { - dic protodb.DB_IteratorClient - cur *protodb.Iterator - err error -} - -var _ db.Iterator = (*iterator)(nil) - -// Valid implements Iterator. -func (itr *iterator) Valid() bool { - return itr.cur != nil && itr.cur.Valid && itr.err == nil -} - -// Domain implements Iterator. -func (itr *iterator) Domain() (start, end []byte) { - if itr.cur == nil || itr.cur.Domain == nil { - return nil, nil - } - return itr.cur.Domain.Start, itr.cur.Domain.End -} - -// Next implements Iterator. -func (itr *iterator) Next() { - var err error - itr.cur, err = itr.dic.Recv() - if err != nil { - itr.err = err - } -} - -// Key implements Iterator. -func (itr *iterator) Key() []byte { - itr.assertIsValid() - return itr.cur.Key -} - -// Value implements Iterator. -func (itr *iterator) Value() []byte { - itr.assertIsValid() - return itr.cur.Value -} - -// Error implements Iterator. -func (itr *iterator) Error() error { - return itr.err -} - -// Close implements Iterator. -func (itr *iterator) Close() error { - return itr.dic.CloseSend() -} - -func (itr *iterator) assertIsValid() { - if !itr.Valid() { - panic("iterator is invalid") - } -} diff --git a/remotedb/proto/defs.pb.go b/remotedb/proto/defs.pb.go deleted file mode 100644 index b2fb0edd4..000000000 --- a/remotedb/proto/defs.pb.go +++ /dev/null @@ -1,1616 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: remotedb/proto/defs.proto - -package protodb - -import ( - bytes "bytes" - context "context" - fmt "fmt" - math "math" - - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type Operation_Type int32 - -const ( - Operation_SET Operation_Type = 0 - Operation_DELETE Operation_Type = 1 -) - -var Operation_Type_name = map[int32]string{ - 0: "SET", - 1: "DELETE", -} - -var Operation_Type_value = map[string]int32{ - "SET": 0, - "DELETE": 1, -} - -func (x Operation_Type) String() string { - return proto.EnumName(Operation_Type_name, int32(x)) -} - -func (Operation_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ef1eada6618d0075, []int{1, 0} -} - -type Batch struct { - Ops []*Operation `protobuf:"bytes,1,rep,name=ops,proto3" json:"ops,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Batch) Reset() { *m = Batch{} } -func (m *Batch) String() string { return proto.CompactTextString(m) } -func (*Batch) ProtoMessage() {} -func (*Batch) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1eada6618d0075, []int{0} -} -func (m *Batch) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Batch.Unmarshal(m, b) -} -func (m *Batch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Batch.Marshal(b, m, deterministic) -} -func (m *Batch) XXX_Merge(src proto.Message) { - xxx_messageInfo_Batch.Merge(m, src) -} -func (m *Batch) XXX_Size() int { - return xxx_messageInfo_Batch.Size(m) -} -func (m *Batch) XXX_DiscardUnknown() { - xxx_messageInfo_Batch.DiscardUnknown(m) -} - -var xxx_messageInfo_Batch proto.InternalMessageInfo - -func (m *Batch) GetOps() []*Operation { - if m != nil { - return m.Ops - } - return nil -} - -type Operation struct { - Entity *Entity `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"` - Type Operation_Type `protobuf:"varint,2,opt,name=type,proto3,enum=protodb.Operation_Type" json:"type,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Operation) Reset() { *m = Operation{} } -func (m *Operation) String() string { return proto.CompactTextString(m) } -func (*Operation) ProtoMessage() {} -func (*Operation) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1eada6618d0075, []int{1} -} -func (m *Operation) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Operation.Unmarshal(m, b) -} -func (m *Operation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Operation.Marshal(b, m, deterministic) -} -func (m *Operation) XXX_Merge(src proto.Message) { - xxx_messageInfo_Operation.Merge(m, src) -} -func (m *Operation) XXX_Size() int { - return xxx_messageInfo_Operation.Size(m) -} -func (m *Operation) XXX_DiscardUnknown() { - xxx_messageInfo_Operation.DiscardUnknown(m) -} - -var xxx_messageInfo_Operation proto.InternalMessageInfo - -func (m *Operation) GetEntity() *Entity { - if m != nil { - return m.Entity - } - return nil -} - -func (m *Operation) GetType() Operation_Type { - if m != nil { - return m.Type - } - return Operation_SET -} - -type Entity struct { - Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - Exists bool `protobuf:"varint,4,opt,name=exists,proto3" json:"exists,omitempty"` - Start []byte `protobuf:"bytes,5,opt,name=start,proto3" json:"start,omitempty"` - End []byte `protobuf:"bytes,6,opt,name=end,proto3" json:"end,omitempty"` - Err string `protobuf:"bytes,7,opt,name=err,proto3" json:"err,omitempty"` - CreatedAt int64 `protobuf:"varint,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Entity) Reset() { *m = Entity{} } -func (m *Entity) String() string { return proto.CompactTextString(m) } -func (*Entity) ProtoMessage() {} -func (*Entity) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1eada6618d0075, []int{2} -} -func (m *Entity) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Entity.Unmarshal(m, b) -} -func (m *Entity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Entity.Marshal(b, m, deterministic) -} -func (m *Entity) XXX_Merge(src proto.Message) { - xxx_messageInfo_Entity.Merge(m, src) -} -func (m *Entity) XXX_Size() int { - return xxx_messageInfo_Entity.Size(m) -} -func (m *Entity) XXX_DiscardUnknown() { - xxx_messageInfo_Entity.DiscardUnknown(m) -} - -var xxx_messageInfo_Entity proto.InternalMessageInfo - -func (m *Entity) GetId() int32 { - if m != nil { - return m.Id - } - return 0 -} - -func (m *Entity) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *Entity) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (m *Entity) GetExists() bool { - if m != nil { - return m.Exists - } - return false -} - -func (m *Entity) GetStart() []byte { - if m != nil { - return m.Start - } - return nil -} - -func (m *Entity) GetEnd() []byte { - if m != nil { - return m.End - } - return nil -} - -func (m *Entity) GetErr() string { - if m != nil { - return m.Err - } - return "" -} - -func (m *Entity) GetCreatedAt() int64 { - if m != nil { - return m.CreatedAt - } - return 0 -} - -type Nothing struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Nothing) Reset() { *m = Nothing{} } -func (m *Nothing) String() string { return proto.CompactTextString(m) } -func (*Nothing) ProtoMessage() {} -func (*Nothing) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1eada6618d0075, []int{3} -} -func (m *Nothing) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Nothing.Unmarshal(m, b) -} -func (m *Nothing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Nothing.Marshal(b, m, deterministic) -} -func (m *Nothing) XXX_Merge(src proto.Message) { - xxx_messageInfo_Nothing.Merge(m, src) -} -func (m *Nothing) XXX_Size() int { - return xxx_messageInfo_Nothing.Size(m) -} -func (m *Nothing) XXX_DiscardUnknown() { - xxx_messageInfo_Nothing.DiscardUnknown(m) -} - -var xxx_messageInfo_Nothing proto.InternalMessageInfo - -type Domain struct { - Start []byte `protobuf:"bytes,1,opt,name=start,proto3" json:"start,omitempty"` - End []byte `protobuf:"bytes,2,opt,name=end,proto3" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Domain) Reset() { *m = Domain{} } -func (m *Domain) String() string { return proto.CompactTextString(m) } -func (*Domain) ProtoMessage() {} -func (*Domain) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1eada6618d0075, []int{4} -} -func (m *Domain) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Domain.Unmarshal(m, b) -} -func (m *Domain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Domain.Marshal(b, m, deterministic) -} -func (m *Domain) XXX_Merge(src proto.Message) { - xxx_messageInfo_Domain.Merge(m, src) -} -func (m *Domain) XXX_Size() int { - return xxx_messageInfo_Domain.Size(m) -} -func (m *Domain) XXX_DiscardUnknown() { - xxx_messageInfo_Domain.DiscardUnknown(m) -} - -var xxx_messageInfo_Domain proto.InternalMessageInfo - -func (m *Domain) GetStart() []byte { - if m != nil { - return m.Start - } - return nil -} - -func (m *Domain) GetEnd() []byte { - if m != nil { - return m.End - } - return nil -} - -type Iterator struct { - Domain *Domain `protobuf:"bytes,1,opt,name=domain,proto3" json:"domain,omitempty"` - Valid bool `protobuf:"varint,2,opt,name=valid,proto3" json:"valid,omitempty"` - Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Iterator) Reset() { *m = Iterator{} } -func (m *Iterator) String() string { return proto.CompactTextString(m) } -func (*Iterator) ProtoMessage() {} -func (*Iterator) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1eada6618d0075, []int{5} -} -func (m *Iterator) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Iterator.Unmarshal(m, b) -} -func (m *Iterator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Iterator.Marshal(b, m, deterministic) -} -func (m *Iterator) XXX_Merge(src proto.Message) { - xxx_messageInfo_Iterator.Merge(m, src) -} -func (m *Iterator) XXX_Size() int { - return xxx_messageInfo_Iterator.Size(m) -} -func (m *Iterator) XXX_DiscardUnknown() { - xxx_messageInfo_Iterator.DiscardUnknown(m) -} - -var xxx_messageInfo_Iterator proto.InternalMessageInfo - -func (m *Iterator) GetDomain() *Domain { - if m != nil { - return m.Domain - } - return nil -} - -func (m *Iterator) GetValid() bool { - if m != nil { - return m.Valid - } - return false -} - -func (m *Iterator) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *Iterator) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -type Stats struct { - Data map[string]string `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - TimeAt int64 `protobuf:"varint,2,opt,name=time_at,json=timeAt,proto3" json:"time_at,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Stats) Reset() { *m = Stats{} } -func (m *Stats) String() string { return proto.CompactTextString(m) } -func (*Stats) ProtoMessage() {} -func (*Stats) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1eada6618d0075, []int{6} -} -func (m *Stats) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Stats.Unmarshal(m, b) -} -func (m *Stats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Stats.Marshal(b, m, deterministic) -} -func (m *Stats) XXX_Merge(src proto.Message) { - xxx_messageInfo_Stats.Merge(m, src) -} -func (m *Stats) XXX_Size() int { - return xxx_messageInfo_Stats.Size(m) -} -func (m *Stats) XXX_DiscardUnknown() { - xxx_messageInfo_Stats.DiscardUnknown(m) -} - -var xxx_messageInfo_Stats proto.InternalMessageInfo - -func (m *Stats) GetData() map[string]string { - if m != nil { - return m.Data - } - return nil -} - -func (m *Stats) GetTimeAt() int64 { - if m != nil { - return m.TimeAt - } - return 0 -} - -type Init struct { - Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` - Dir string `protobuf:"bytes,3,opt,name=Dir,proto3" json:"Dir,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Init) Reset() { *m = Init{} } -func (m *Init) String() string { return proto.CompactTextString(m) } -func (*Init) ProtoMessage() {} -func (*Init) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1eada6618d0075, []int{7} -} -func (m *Init) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Init.Unmarshal(m, b) -} -func (m *Init) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Init.Marshal(b, m, deterministic) -} -func (m *Init) XXX_Merge(src proto.Message) { - xxx_messageInfo_Init.Merge(m, src) -} -func (m *Init) XXX_Size() int { - return xxx_messageInfo_Init.Size(m) -} -func (m *Init) XXX_DiscardUnknown() { - xxx_messageInfo_Init.DiscardUnknown(m) -} - -var xxx_messageInfo_Init proto.InternalMessageInfo - -func (m *Init) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *Init) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Init) GetDir() string { - if m != nil { - return m.Dir - } - return "" -} - -func init() { - proto.RegisterEnum("protodb.Operation_Type", Operation_Type_name, Operation_Type_value) - proto.RegisterType((*Batch)(nil), "protodb.Batch") - proto.RegisterType((*Operation)(nil), "protodb.Operation") - proto.RegisterType((*Entity)(nil), "protodb.Entity") - proto.RegisterType((*Nothing)(nil), "protodb.Nothing") - proto.RegisterType((*Domain)(nil), "protodb.Domain") - proto.RegisterType((*Iterator)(nil), "protodb.Iterator") - proto.RegisterType((*Stats)(nil), "protodb.Stats") - proto.RegisterMapType((map[string]string)(nil), "protodb.Stats.DataEntry") - proto.RegisterType((*Init)(nil), "protodb.Init") -} - -func init() { proto.RegisterFile("remotedb/proto/defs.proto", fileDescriptor_ef1eada6618d0075) } - -var fileDescriptor_ef1eada6618d0075 = []byte{ - // 662 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4d, 0x6f, 0xd3, 0x4a, - 0x14, 0xcd, 0xd8, 0x8e, 0x13, 0xdf, 0xf6, 0xa5, 0x79, 0xa3, 0xa7, 0x57, 0xbf, 0x3c, 0x51, 0x45, - 0x16, 0x12, 0x86, 0x52, 0x37, 0xa4, 0x48, 0x7c, 0xac, 0x68, 0x95, 0x2c, 0x2a, 0xa1, 0x22, 0x39, - 0x95, 0x58, 0xa2, 0x49, 0x3c, 0x4d, 0x46, 0x34, 0x76, 0x18, 0xdf, 0x56, 0x64, 0xc3, 0x96, 0xbf, - 0xc2, 0x96, 0x1d, 0x7f, 0x87, 0xfe, 0x0a, 0x24, 0x36, 0x68, 0x66, 0x1c, 0x87, 0x36, 0x59, 0x84, - 0x55, 0xee, 0xc7, 0x39, 0xe7, 0xce, 0x9c, 0x5c, 0x0f, 0xfc, 0x27, 0xf9, 0x34, 0x43, 0x9e, 0x0c, - 0x0f, 0x67, 0x32, 0xc3, 0xec, 0x30, 0xe1, 0x17, 0x79, 0xa4, 0x43, 0x5a, 0xd3, 0x3f, 0xc9, 0xb0, - 0x75, 0x30, 0x16, 0x38, 0xb9, 0x1a, 0x46, 0xa3, 0x6c, 0x7a, 0x38, 0xce, 0xc6, 0x99, 0x81, 0x0e, - 0xaf, 0x2e, 0x74, 0x66, 0x78, 0x2a, 0x32, 0xbc, 0xe0, 0x00, 0xaa, 0x27, 0x0c, 0x47, 0x13, 0x7a, - 0x1f, 0xec, 0x6c, 0x96, 0xfb, 0xa4, 0x6d, 0x87, 0x5b, 0x5d, 0x1a, 0x15, 0x72, 0xd1, 0x9b, 0x19, - 0x97, 0x0c, 0x45, 0x96, 0xc6, 0xaa, 0x1d, 0x7c, 0x02, 0xaf, 0xac, 0xd0, 0x07, 0xe0, 0xf2, 0x14, - 0x05, 0xce, 0x7d, 0xd2, 0x26, 0xe1, 0x56, 0x77, 0xa7, 0x64, 0xf5, 0x75, 0x39, 0x2e, 0xda, 0x74, - 0x1f, 0x1c, 0x9c, 0xcf, 0xb8, 0x6f, 0xb5, 0x49, 0xd8, 0xe8, 0xee, 0xae, 0x8a, 0x47, 0xe7, 0xf3, - 0x19, 0x8f, 0x35, 0x28, 0xf8, 0x1f, 0x1c, 0x95, 0xd1, 0x1a, 0xd8, 0x83, 0xfe, 0x79, 0xb3, 0x42, - 0x01, 0xdc, 0x5e, 0xff, 0x75, 0xff, 0xbc, 0xdf, 0x24, 0xc1, 0x57, 0x02, 0xae, 0x11, 0xa7, 0x0d, - 0xb0, 0x44, 0xa2, 0x27, 0x57, 0x63, 0x4b, 0x24, 0xb4, 0x09, 0xf6, 0x7b, 0x3e, 0xd7, 0x33, 0xb6, - 0x63, 0x15, 0xd2, 0x7f, 0xa0, 0x7a, 0xcd, 0x2e, 0xaf, 0xb8, 0x6f, 0xeb, 0x9a, 0x49, 0xe8, 0xbf, - 0xe0, 0xf2, 0x8f, 0x22, 0xc7, 0xdc, 0x77, 0xda, 0x24, 0xac, 0xc7, 0x45, 0xa6, 0xd0, 0x39, 0x32, - 0x89, 0x7e, 0xd5, 0xa0, 0x75, 0xa2, 0x54, 0x79, 0x9a, 0xf8, 0xae, 0x51, 0xe5, 0xa9, 0x9e, 0xc3, - 0xa5, 0xf4, 0x6b, 0x6d, 0x12, 0x7a, 0xb1, 0x0a, 0xe9, 0x3d, 0x80, 0x91, 0xe4, 0x0c, 0x79, 0xf2, - 0x8e, 0xa1, 0x5f, 0x6f, 0x93, 0xd0, 0x8e, 0xbd, 0xa2, 0x72, 0x8c, 0x81, 0x07, 0xb5, 0xb3, 0x0c, - 0x27, 0x22, 0x1d, 0x07, 0x1d, 0x70, 0x7b, 0xd9, 0x94, 0x89, 0x74, 0x39, 0x8d, 0xac, 0x99, 0x66, - 0x95, 0xd3, 0x82, 0x0f, 0x50, 0x3f, 0x45, 0xe5, 0x52, 0x26, 0x95, 0xdf, 0x89, 0x66, 0xaf, 0xf8, - 0x6d, 0x44, 0xe3, 0xa2, 0x5d, 0x5c, 0x5c, 0x18, 0xa1, 0x7a, 0x6c, 0x92, 0x85, 0x41, 0xf6, 0x1a, - 0x83, 0x9c, 0xdf, 0x0c, 0x0a, 0x3e, 0x13, 0xa8, 0x0e, 0x90, 0x61, 0x4e, 0x1f, 0x83, 0x93, 0x30, - 0x64, 0xc5, 0x52, 0xf8, 0xe5, 0x38, 0xdd, 0x8d, 0x7a, 0x0c, 0x59, 0x3f, 0x45, 0x39, 0x8f, 0x35, - 0x8a, 0xee, 0x42, 0x0d, 0xc5, 0x94, 0x2b, 0x0f, 0x2c, 0xed, 0x81, 0xab, 0xd2, 0x63, 0x6c, 0x3d, - 0x03, 0xaf, 0xc4, 0x2e, 0x4e, 0x41, 0x8c, 0x7d, 0xb7, 0x4e, 0x61, 0xe9, 0x9a, 0x49, 0x5e, 0x5a, - 0xcf, 0x49, 0xf0, 0x0a, 0x9c, 0xd3, 0x54, 0x20, 0xa5, 0x66, 0x25, 0x0a, 0x92, 0x59, 0x0f, 0x0a, - 0xce, 0x19, 0x9b, 0x2e, 0x48, 0x3a, 0x56, 0xda, 0x3d, 0x21, 0xf5, 0x0d, 0xbd, 0x58, 0x85, 0xdd, - 0x9f, 0x0e, 0x58, 0xbd, 0x13, 0x1a, 0x82, 0x23, 0x94, 0xd0, 0x5f, 0xe5, 0x15, 0x94, 0x6e, 0xeb, - 0xee, 0xc2, 0x06, 0x15, 0xfa, 0x10, 0xec, 0x31, 0x47, 0x7a, 0xb7, 0xb3, 0x0e, 0x7a, 0x04, 0xde, - 0x98, 0xe3, 0x00, 0x25, 0x67, 0xd3, 0x4d, 0x08, 0x21, 0xe9, 0x10, 0xa5, 0x3f, 0x61, 0xf9, 0x46, - 0xfa, 0x8f, 0xc0, 0xce, 0xd7, 0x1d, 0xa5, 0x59, 0x16, 0x16, 0x6b, 0x55, 0xa1, 0x11, 0xd4, 0x72, - 0x8e, 0x83, 0x79, 0x3a, 0xda, 0x0c, 0x7f, 0x00, 0x6e, 0xc2, 0x2f, 0x39, 0xf2, 0xcd, 0xe0, 0x4f, - 0x00, 0x0c, 0x7c, 0xf3, 0x09, 0x5d, 0xa8, 0x8b, 0xc5, 0xe2, 0xae, 0x10, 0xfe, 0x5e, 0xfe, 0x0f, - 0x05, 0x26, 0xa8, 0x74, 0x08, 0x7d, 0x01, 0x3b, 0x92, 0x5f, 0x73, 0x99, 0xf3, 0xd3, 0x3f, 0xa5, - 0xee, 0xeb, 0xef, 0x09, 0x73, 0xba, 0x72, 0x96, 0x56, 0xe3, 0xf6, 0xde, 0x06, 0x15, 0xda, 0x01, - 0x18, 0xaa, 0x47, 0xef, 0xad, 0x14, 0xc8, 0xe9, 0xb2, 0xaf, 0x5f, 0xc2, 0xb5, 0xb7, 0x79, 0x0a, - 0x8d, 0x25, 0x43, 0x9b, 0xb0, 0x01, 0xeb, 0x64, 0xfb, 0xc7, 0xf7, 0x3d, 0xf2, 0xe5, 0x66, 0x8f, - 0x7c, 0xbb, 0xd9, 0x23, 0x43, 0x57, 0x03, 0x8e, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0xc5, 0x88, - 0xfd, 0x5e, 0xc6, 0x05, 0x00, 0x00, -} - -func (this *Batch) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Batch) - if !ok { - that2, ok := that.(Batch) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.Ops) != len(that1.Ops) { - return false - } - for i := range this.Ops { - if !this.Ops[i].Equal(that1.Ops[i]) { - return false - } - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func (this *Operation) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Operation) - if !ok { - that2, ok := that.(Operation) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Entity.Equal(that1.Entity) { - return false - } - if this.Type != that1.Type { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func (this *Entity) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Entity) - if !ok { - that2, ok := that.(Entity) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Id != that1.Id { - return false - } - if !bytes.Equal(this.Key, that1.Key) { - return false - } - if !bytes.Equal(this.Value, that1.Value) { - return false - } - if this.Exists != that1.Exists { - return false - } - if !bytes.Equal(this.Start, that1.Start) { - return false - } - if !bytes.Equal(this.End, that1.End) { - return false - } - if this.Err != that1.Err { - return false - } - if this.CreatedAt != that1.CreatedAt { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func (this *Nothing) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Nothing) - if !ok { - that2, ok := that.(Nothing) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func (this *Domain) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Domain) - if !ok { - that2, ok := that.(Domain) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Start, that1.Start) { - return false - } - if !bytes.Equal(this.End, that1.End) { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func (this *Iterator) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Iterator) - if !ok { - that2, ok := that.(Iterator) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Domain.Equal(that1.Domain) { - return false - } - if this.Valid != that1.Valid { - return false - } - if !bytes.Equal(this.Key, that1.Key) { - return false - } - if !bytes.Equal(this.Value, that1.Value) { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func (this *Stats) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Stats) - if !ok { - that2, ok := that.(Stats) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.Data) != len(that1.Data) { - return false - } - for i := range this.Data { - if this.Data[i] != that1.Data[i] { - return false - } - } - if this.TimeAt != that1.TimeAt { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func (this *Init) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Init) - if !ok { - that2, ok := that.(Init) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Type != that1.Type { - return false - } - if this.Name != that1.Name { - return false - } - if this.Dir != that1.Dir { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// DBClient is the client API for DB service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type DBClient interface { - Init(ctx context.Context, in *Init, opts ...grpc.CallOption) (*Entity, error) - Get(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Entity, error) - GetStream(ctx context.Context, opts ...grpc.CallOption) (DB_GetStreamClient, error) - Has(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Entity, error) - Set(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) - SetSync(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) - Delete(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) - DeleteSync(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) - Iterator(ctx context.Context, in *Entity, opts ...grpc.CallOption) (DB_IteratorClient, error) - ReverseIterator(ctx context.Context, in *Entity, opts ...grpc.CallOption) (DB_ReverseIteratorClient, error) - // rpc print(Nothing) returns (Entity) {} - Stats(ctx context.Context, in *Nothing, opts ...grpc.CallOption) (*Stats, error) - BatchWrite(ctx context.Context, in *Batch, opts ...grpc.CallOption) (*Nothing, error) - BatchWriteSync(ctx context.Context, in *Batch, opts ...grpc.CallOption) (*Nothing, error) -} - -type dBClient struct { - cc *grpc.ClientConn -} - -func NewDBClient(cc *grpc.ClientConn) DBClient { - return &dBClient{cc} -} - -func (c *dBClient) Init(ctx context.Context, in *Init, opts ...grpc.CallOption) (*Entity, error) { - out := new(Entity) - err := c.cc.Invoke(ctx, "/protodb.DB/init", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dBClient) Get(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Entity, error) { - out := new(Entity) - err := c.cc.Invoke(ctx, "/protodb.DB/get", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dBClient) GetStream(ctx context.Context, opts ...grpc.CallOption) (DB_GetStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_DB_serviceDesc.Streams[0], "/protodb.DB/getStream", opts...) - if err != nil { - return nil, err - } - x := &dBGetStreamClient{stream} - return x, nil -} - -type DB_GetStreamClient interface { - Send(*Entity) error - Recv() (*Entity, error) - grpc.ClientStream -} - -type dBGetStreamClient struct { - grpc.ClientStream -} - -func (x *dBGetStreamClient) Send(m *Entity) error { - return x.ClientStream.SendMsg(m) -} - -func (x *dBGetStreamClient) Recv() (*Entity, error) { - m := new(Entity) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *dBClient) Has(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Entity, error) { - out := new(Entity) - err := c.cc.Invoke(ctx, "/protodb.DB/has", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dBClient) Set(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) { - out := new(Nothing) - err := c.cc.Invoke(ctx, "/protodb.DB/set", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dBClient) SetSync(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) { - out := new(Nothing) - err := c.cc.Invoke(ctx, "/protodb.DB/setSync", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dBClient) Delete(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) { - out := new(Nothing) - err := c.cc.Invoke(ctx, "/protodb.DB/delete", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dBClient) DeleteSync(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) { - out := new(Nothing) - err := c.cc.Invoke(ctx, "/protodb.DB/deleteSync", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dBClient) Iterator(ctx context.Context, in *Entity, opts ...grpc.CallOption) (DB_IteratorClient, error) { - stream, err := c.cc.NewStream(ctx, &_DB_serviceDesc.Streams[1], "/protodb.DB/iterator", opts...) - if err != nil { - return nil, err - } - x := &dBIteratorClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type DB_IteratorClient interface { - Recv() (*Iterator, error) - grpc.ClientStream -} - -type dBIteratorClient struct { - grpc.ClientStream -} - -func (x *dBIteratorClient) Recv() (*Iterator, error) { - m := new(Iterator) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *dBClient) ReverseIterator(ctx context.Context, in *Entity, opts ...grpc.CallOption) (DB_ReverseIteratorClient, error) { - stream, err := c.cc.NewStream(ctx, &_DB_serviceDesc.Streams[2], "/protodb.DB/reverseIterator", opts...) - if err != nil { - return nil, err - } - x := &dBReverseIteratorClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type DB_ReverseIteratorClient interface { - Recv() (*Iterator, error) - grpc.ClientStream -} - -type dBReverseIteratorClient struct { - grpc.ClientStream -} - -func (x *dBReverseIteratorClient) Recv() (*Iterator, error) { - m := new(Iterator) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *dBClient) Stats(ctx context.Context, in *Nothing, opts ...grpc.CallOption) (*Stats, error) { - out := new(Stats) - err := c.cc.Invoke(ctx, "/protodb.DB/stats", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dBClient) BatchWrite(ctx context.Context, in *Batch, opts ...grpc.CallOption) (*Nothing, error) { - out := new(Nothing) - err := c.cc.Invoke(ctx, "/protodb.DB/batchWrite", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dBClient) BatchWriteSync(ctx context.Context, in *Batch, opts ...grpc.CallOption) (*Nothing, error) { - out := new(Nothing) - err := c.cc.Invoke(ctx, "/protodb.DB/batchWriteSync", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// DBServer is the server API for DB service. -type DBServer interface { - Init(context.Context, *Init) (*Entity, error) - Get(context.Context, *Entity) (*Entity, error) - GetStream(DB_GetStreamServer) error - Has(context.Context, *Entity) (*Entity, error) - Set(context.Context, *Entity) (*Nothing, error) - SetSync(context.Context, *Entity) (*Nothing, error) - Delete(context.Context, *Entity) (*Nothing, error) - DeleteSync(context.Context, *Entity) (*Nothing, error) - Iterator(*Entity, DB_IteratorServer) error - ReverseIterator(*Entity, DB_ReverseIteratorServer) error - // rpc print(Nothing) returns (Entity) {} - Stats(context.Context, *Nothing) (*Stats, error) - BatchWrite(context.Context, *Batch) (*Nothing, error) - BatchWriteSync(context.Context, *Batch) (*Nothing, error) -} - -// UnimplementedDBServer can be embedded to have forward compatible implementations. -type UnimplementedDBServer struct { -} - -func (*UnimplementedDBServer) Init(ctx context.Context, req *Init) (*Entity, error) { - return nil, status.Errorf(codes.Unimplemented, "method Init not implemented") -} -func (*UnimplementedDBServer) Get(ctx context.Context, req *Entity) (*Entity, error) { - return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") -} -func (*UnimplementedDBServer) GetStream(srv DB_GetStreamServer) error { - return status.Errorf(codes.Unimplemented, "method GetStream not implemented") -} -func (*UnimplementedDBServer) Has(ctx context.Context, req *Entity) (*Entity, error) { - return nil, status.Errorf(codes.Unimplemented, "method Has not implemented") -} -func (*UnimplementedDBServer) Set(ctx context.Context, req *Entity) (*Nothing, error) { - return nil, status.Errorf(codes.Unimplemented, "method Set not implemented") -} -func (*UnimplementedDBServer) SetSync(ctx context.Context, req *Entity) (*Nothing, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetSync not implemented") -} -func (*UnimplementedDBServer) Delete(ctx context.Context, req *Entity) (*Nothing, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") -} -func (*UnimplementedDBServer) DeleteSync(ctx context.Context, req *Entity) (*Nothing, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteSync not implemented") -} -func (*UnimplementedDBServer) Iterator(req *Entity, srv DB_IteratorServer) error { - return status.Errorf(codes.Unimplemented, "method Iterator not implemented") -} -func (*UnimplementedDBServer) ReverseIterator(req *Entity, srv DB_ReverseIteratorServer) error { - return status.Errorf(codes.Unimplemented, "method ReverseIterator not implemented") -} -func (*UnimplementedDBServer) Stats(ctx context.Context, req *Nothing) (*Stats, error) { - return nil, status.Errorf(codes.Unimplemented, "method Stats not implemented") -} -func (*UnimplementedDBServer) BatchWrite(ctx context.Context, req *Batch) (*Nothing, error) { - return nil, status.Errorf(codes.Unimplemented, "method BatchWrite not implemented") -} -func (*UnimplementedDBServer) BatchWriteSync(ctx context.Context, req *Batch) (*Nothing, error) { - return nil, status.Errorf(codes.Unimplemented, "method BatchWriteSync not implemented") -} - -func RegisterDBServer(s *grpc.Server, srv DBServer) { - s.RegisterService(&_DB_serviceDesc, srv) -} - -func _DB_Init_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Init) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DBServer).Init(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protodb.DB/Init", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DBServer).Init(ctx, req.(*Init)) - } - return interceptor(ctx, in, info, handler) -} - -func _DB_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Entity) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DBServer).Get(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protodb.DB/Get", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DBServer).Get(ctx, req.(*Entity)) - } - return interceptor(ctx, in, info, handler) -} - -func _DB_GetStream_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(DBServer).GetStream(&dBGetStreamServer{stream}) -} - -type DB_GetStreamServer interface { - Send(*Entity) error - Recv() (*Entity, error) - grpc.ServerStream -} - -type dBGetStreamServer struct { - grpc.ServerStream -} - -func (x *dBGetStreamServer) Send(m *Entity) error { - return x.ServerStream.SendMsg(m) -} - -func (x *dBGetStreamServer) Recv() (*Entity, error) { - m := new(Entity) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _DB_Has_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Entity) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DBServer).Has(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protodb.DB/Has", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DBServer).Has(ctx, req.(*Entity)) - } - return interceptor(ctx, in, info, handler) -} - -func _DB_Set_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Entity) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DBServer).Set(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protodb.DB/Set", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DBServer).Set(ctx, req.(*Entity)) - } - return interceptor(ctx, in, info, handler) -} - -func _DB_SetSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Entity) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DBServer).SetSync(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protodb.DB/SetSync", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DBServer).SetSync(ctx, req.(*Entity)) - } - return interceptor(ctx, in, info, handler) -} - -func _DB_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Entity) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DBServer).Delete(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protodb.DB/Delete", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DBServer).Delete(ctx, req.(*Entity)) - } - return interceptor(ctx, in, info, handler) -} - -func _DB_DeleteSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Entity) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DBServer).DeleteSync(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protodb.DB/DeleteSync", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DBServer).DeleteSync(ctx, req.(*Entity)) - } - return interceptor(ctx, in, info, handler) -} - -func _DB_Iterator_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(Entity) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(DBServer).Iterator(m, &dBIteratorServer{stream}) -} - -type DB_IteratorServer interface { - Send(*Iterator) error - grpc.ServerStream -} - -type dBIteratorServer struct { - grpc.ServerStream -} - -func (x *dBIteratorServer) Send(m *Iterator) error { - return x.ServerStream.SendMsg(m) -} - -func _DB_ReverseIterator_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(Entity) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(DBServer).ReverseIterator(m, &dBReverseIteratorServer{stream}) -} - -type DB_ReverseIteratorServer interface { - Send(*Iterator) error - grpc.ServerStream -} - -type dBReverseIteratorServer struct { - grpc.ServerStream -} - -func (x *dBReverseIteratorServer) Send(m *Iterator) error { - return x.ServerStream.SendMsg(m) -} - -func _DB_Stats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Nothing) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DBServer).Stats(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protodb.DB/Stats", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DBServer).Stats(ctx, req.(*Nothing)) - } - return interceptor(ctx, in, info, handler) -} - -func _DB_BatchWrite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Batch) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DBServer).BatchWrite(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protodb.DB/BatchWrite", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DBServer).BatchWrite(ctx, req.(*Batch)) - } - return interceptor(ctx, in, info, handler) -} - -func _DB_BatchWriteSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Batch) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DBServer).BatchWriteSync(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protodb.DB/BatchWriteSync", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DBServer).BatchWriteSync(ctx, req.(*Batch)) - } - return interceptor(ctx, in, info, handler) -} - -var _DB_serviceDesc = grpc.ServiceDesc{ - ServiceName: "protodb.DB", - HandlerType: (*DBServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "init", - Handler: _DB_Init_Handler, - }, - { - MethodName: "get", - Handler: _DB_Get_Handler, - }, - { - MethodName: "has", - Handler: _DB_Has_Handler, - }, - { - MethodName: "set", - Handler: _DB_Set_Handler, - }, - { - MethodName: "setSync", - Handler: _DB_SetSync_Handler, - }, - { - MethodName: "delete", - Handler: _DB_Delete_Handler, - }, - { - MethodName: "deleteSync", - Handler: _DB_DeleteSync_Handler, - }, - { - MethodName: "stats", - Handler: _DB_Stats_Handler, - }, - { - MethodName: "batchWrite", - Handler: _DB_BatchWrite_Handler, - }, - { - MethodName: "batchWriteSync", - Handler: _DB_BatchWriteSync_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "getStream", - Handler: _DB_GetStream_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "iterator", - Handler: _DB_Iterator_Handler, - ServerStreams: true, - }, - { - StreamName: "reverseIterator", - Handler: _DB_ReverseIterator_Handler, - ServerStreams: true, - }, - }, - Metadata: "remotedb/proto/defs.proto", -} - -func NewPopulatedBatch(r randyDefs, easy bool) *Batch { - this := &Batch{} - if r.Intn(5) != 0 { - v1 := r.Intn(5) - this.Ops = make([]*Operation, v1) - for i := 0; i < v1; i++ { - this.Ops[i] = NewPopulatedOperation(r, easy) - } - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedDefs(r, 2) - } - return this -} - -func NewPopulatedOperation(r randyDefs, easy bool) *Operation { - this := &Operation{} - if r.Intn(5) != 0 { - this.Entity = NewPopulatedEntity(r, easy) - } - this.Type = Operation_Type([]int32{0, 1}[r.Intn(2)]) - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedDefs(r, 3) - } - return this -} - -func NewPopulatedEntity(r randyDefs, easy bool) *Entity { - this := &Entity{} - this.Id = int32(r.Int31()) - if r.Intn(2) == 0 { - this.Id *= -1 - } - v2 := r.Intn(100) - this.Key = make([]byte, v2) - for i := 0; i < v2; i++ { - this.Key[i] = byte(r.Intn(256)) - } - v3 := r.Intn(100) - this.Value = make([]byte, v3) - for i := 0; i < v3; i++ { - this.Value[i] = byte(r.Intn(256)) - } - this.Exists = bool(bool(r.Intn(2) == 0)) - v4 := r.Intn(100) - this.Start = make([]byte, v4) - for i := 0; i < v4; i++ { - this.Start[i] = byte(r.Intn(256)) - } - v5 := r.Intn(100) - this.End = make([]byte, v5) - for i := 0; i < v5; i++ { - this.End[i] = byte(r.Intn(256)) - } - this.Err = string(randStringDefs(r)) - this.CreatedAt = int64(r.Int63()) - if r.Intn(2) == 0 { - this.CreatedAt *= -1 - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedDefs(r, 9) - } - return this -} - -func NewPopulatedNothing(r randyDefs, easy bool) *Nothing { - this := &Nothing{} - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedDefs(r, 1) - } - return this -} - -func NewPopulatedDomain(r randyDefs, easy bool) *Domain { - this := &Domain{} - v6 := r.Intn(100) - this.Start = make([]byte, v6) - for i := 0; i < v6; i++ { - this.Start[i] = byte(r.Intn(256)) - } - v7 := r.Intn(100) - this.End = make([]byte, v7) - for i := 0; i < v7; i++ { - this.End[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedDefs(r, 3) - } - return this -} - -func NewPopulatedIterator(r randyDefs, easy bool) *Iterator { - this := &Iterator{} - if r.Intn(5) != 0 { - this.Domain = NewPopulatedDomain(r, easy) - } - this.Valid = bool(bool(r.Intn(2) == 0)) - v8 := r.Intn(100) - this.Key = make([]byte, v8) - for i := 0; i < v8; i++ { - this.Key[i] = byte(r.Intn(256)) - } - v9 := r.Intn(100) - this.Value = make([]byte, v9) - for i := 0; i < v9; i++ { - this.Value[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedDefs(r, 5) - } - return this -} - -func NewPopulatedStats(r randyDefs, easy bool) *Stats { - this := &Stats{} - if r.Intn(5) != 0 { - v10 := r.Intn(10) - this.Data = make(map[string]string) - for i := 0; i < v10; i++ { - this.Data[randStringDefs(r)] = randStringDefs(r) - } - } - this.TimeAt = int64(r.Int63()) - if r.Intn(2) == 0 { - this.TimeAt *= -1 - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedDefs(r, 3) - } - return this -} - -func NewPopulatedInit(r randyDefs, easy bool) *Init { - this := &Init{} - this.Type = string(randStringDefs(r)) - this.Name = string(randStringDefs(r)) - this.Dir = string(randStringDefs(r)) - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedDefs(r, 4) - } - return this -} - -type randyDefs interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneDefs(r randyDefs) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringDefs(r randyDefs) string { - v11 := r.Intn(100) - tmps := make([]rune, v11) - for i := 0; i < v11; i++ { - tmps[i] = randUTF8RuneDefs(r) - } - return string(tmps) -} -func randUnrecognizedDefs(r randyDefs, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldDefs(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldDefs(dAtA []byte, r randyDefs, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateDefs(dAtA, uint64(key)) - v12 := r.Int63() - if r.Intn(2) == 0 { - v12 *= -1 - } - dAtA = encodeVarintPopulateDefs(dAtA, uint64(v12)) - case 1: - dAtA = encodeVarintPopulateDefs(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateDefs(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateDefs(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateDefs(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateDefs(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} diff --git a/remotedb/proto/defs.proto b/remotedb/proto/defs.proto deleted file mode 100644 index 136e75f52..000000000 --- a/remotedb/proto/defs.proto +++ /dev/null @@ -1,78 +0,0 @@ -syntax = "proto3"; - -package protodb; - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -// Generate tests -option (gogoproto.populate_all) = true; -option (gogoproto.equal_all) = true; -option (gogoproto.testgen_all) = true; - -message Batch { - repeated Operation ops = 1; -} - -message Operation { - Entity entity = 1; - enum Type { - SET = 0; - DELETE = 1; - } - Type type = 2; -} - -message Entity { - int32 id = 1; - bytes key = 2; - bytes value = 3; - bool exists = 4; - bytes start = 5; - bytes end = 6; - string err = 7; - int64 created_at = 8; -} - -message Nothing { -} - -message Domain { - bytes start = 1; - bytes end = 2; -} - -message Iterator { - Domain domain = 1; - bool valid = 2; - bytes key = 3; - bytes value = 4; -} - -message Stats { - map data = 1; - int64 time_at = 2; -} - -message Init { - string Type = 1; - string Name = 2; - string Dir = 3; -} - -service DB { - rpc init(Init) returns (Entity) {} - rpc get(Entity) returns (Entity) {} - rpc getStream(stream Entity) returns (stream Entity) {} - - rpc has(Entity) returns (Entity) {} - rpc set(Entity) returns (Nothing) {} - rpc setSync(Entity) returns (Nothing) {} - rpc delete(Entity) returns (Nothing) {} - rpc deleteSync(Entity) returns (Nothing) {} - rpc iterator(Entity) returns (stream Iterator) {} - rpc reverseIterator(Entity) returns (stream Iterator) {} - // rpc print(Nothing) returns (Entity) {} - rpc stats(Nothing) returns (Stats) {} - rpc batchWrite(Batch) returns (Nothing) {} - rpc batchWriteSync(Batch) returns (Nothing) {} -} diff --git a/remotedb/proto/defspb_test.go b/remotedb/proto/defspb_test.go deleted file mode 100644 index 862a31939..000000000 --- a/remotedb/proto/defspb_test.go +++ /dev/null @@ -1,640 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: remotedb/proto/defs.proto - -package protodb - -import ( - fmt "fmt" - math "math" - math_rand "math/rand" - testing "testing" - time "time" - - _ "github.com/gogo/protobuf/gogoproto" - github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -func TestBatchProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBatch(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Batch{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestOperationProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedOperation(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Operation{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestEntityProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedEntity(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Entity{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestNothingProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNothing(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Nothing{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestDomainProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedDomain(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Domain{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestIteratorProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIterator(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Iterator{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestStatsProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedStats(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Stats{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestInitProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedInit(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Init{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestBatchJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBatch(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Batch{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestOperationJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedOperation(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Operation{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestEntityJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedEntity(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Entity{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestNothingJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNothing(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Nothing{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestDomainJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedDomain(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Domain{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestIteratorJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIterator(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Iterator{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestStatsJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedStats(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Stats{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestInitJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedInit(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Init{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestBatchProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBatch(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Batch{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestBatchProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBatch(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Batch{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestOperationProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedOperation(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Operation{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestOperationProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedOperation(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Operation{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestEntityProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedEntity(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Entity{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestEntityProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedEntity(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Entity{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestNothingProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNothing(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Nothing{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestNothingProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNothing(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Nothing{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestDomainProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedDomain(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Domain{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestDomainProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedDomain(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Domain{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestIteratorProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIterator(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Iterator{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestIteratorProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIterator(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Iterator{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestStatsProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedStats(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Stats{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestStatsProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedStats(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Stats{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestInitProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedInit(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Init{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestInitProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedInit(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Init{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -//These tests are generated by github.com/gogo/protobuf/plugin/testgen diff --git a/remotedb/remotedb.go b/remotedb/remotedb.go deleted file mode 100644 index 84a57f20f..000000000 --- a/remotedb/remotedb.go +++ /dev/null @@ -1,123 +0,0 @@ -package remotedb - -import ( - "context" - "errors" - "fmt" - - db "github.com/tendermint/tm-db" - "github.com/tendermint/tm-db/remotedb/grpcdb" - protodb "github.com/tendermint/tm-db/remotedb/proto" -) - -type RemoteDB struct { - ctx context.Context - dc protodb.DBClient -} - -func NewRemoteDB(serverAddr string, serverKey string) (*RemoteDB, error) { - return newRemoteDB(grpcdb.NewClient(serverAddr, serverKey)) -} - -func newRemoteDB(gdc protodb.DBClient, err error) (*RemoteDB, error) { - if err != nil { - return nil, err - } - return &RemoteDB{dc: gdc, ctx: context.Background()}, nil -} - -type Init struct { - Dir string - Name string - Type string -} - -func (rd *RemoteDB) InitRemote(in *Init) error { - _, err := rd.dc.Init(rd.ctx, &protodb.Init{Dir: in.Dir, Type: in.Type, Name: in.Name}) - return err -} - -var _ db.DB = (*RemoteDB)(nil) - -// Close is a noop currently -func (rd *RemoteDB) Close() error { - return nil -} - -func (rd *RemoteDB) Delete(key []byte) error { - if _, err := rd.dc.Delete(rd.ctx, &protodb.Entity{Key: key}); err != nil { - return fmt.Errorf("remoteDB.Delete: %w", err) - } - return nil -} - -func (rd *RemoteDB) DeleteSync(key []byte) error { - if _, err := rd.dc.DeleteSync(rd.ctx, &protodb.Entity{Key: key}); err != nil { - return fmt.Errorf("remoteDB.DeleteSync: %w", err) - } - return nil -} - -func (rd *RemoteDB) Set(key, value []byte) error { - if _, err := rd.dc.Set(rd.ctx, &protodb.Entity{Key: key, Value: value}); err != nil { - return fmt.Errorf("remoteDB.Set: %w", err) - } - return nil -} - -func (rd *RemoteDB) SetSync(key, value []byte) error { - if _, err := rd.dc.SetSync(rd.ctx, &protodb.Entity{Key: key, Value: value}); err != nil { - return fmt.Errorf("remoteDB.SetSync: %w", err) - } - return nil -} - -func (rd *RemoteDB) Get(key []byte) ([]byte, error) { - res, err := rd.dc.Get(rd.ctx, &protodb.Entity{Key: key}) - if err != nil { - return nil, fmt.Errorf("remoteDB.Get error: %w", err) - } - return res.Value, nil -} - -func (rd *RemoteDB) Has(key []byte) (bool, error) { - res, err := rd.dc.Has(rd.ctx, &protodb.Entity{Key: key}) - if err != nil { - return false, err - } - return res.Exists, nil -} - -func (rd *RemoteDB) ReverseIterator(start, end []byte) (db.Iterator, error) { - dic, err := rd.dc.ReverseIterator(rd.ctx, &protodb.Entity{Start: start, End: end}) - if err != nil { - return nil, fmt.Errorf("RemoteDB.Iterator error: %w", err) - } - return makeReverseIterator(dic), nil -} - -func (rd *RemoteDB) NewBatch() db.Batch { - return newBatch(rd) -} - -// TODO: Implement Print when db.DB implements a method -// to print to a string and not db.Print to stdout. -func (rd *RemoteDB) Print() error { - return errors.New("remoteDB.Print: unimplemented") -} - -func (rd *RemoteDB) Stats() map[string]string { - stats, err := rd.dc.Stats(rd.ctx, &protodb.Nothing{}) - if err != nil || stats == nil { - return nil - } - return stats.Data -} - -func (rd *RemoteDB) Iterator(start, end []byte) (db.Iterator, error) { - dic, err := rd.dc.Iterator(rd.ctx, &protodb.Entity{Start: start, End: end}) - if err != nil { - return nil, fmt.Errorf("RemoteDB.Iterator error: %w", err) - } - return makeIterator(dic), nil -} diff --git a/remotedb/remotedb_test.go b/remotedb/remotedb_test.go deleted file mode 100644 index 8407b3004..000000000 --- a/remotedb/remotedb_test.go +++ /dev/null @@ -1,167 +0,0 @@ -package remotedb_test - -import ( - "net" - "os" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/tendermint/tm-db/remotedb" - "github.com/tendermint/tm-db/remotedb/grpcdb" -) - -func TestRemoteDB(t *testing.T) { - cert := "test.crt" - key := "test.key" - ln, err := net.Listen("tcp", "localhost:0") - require.Nil(t, err, "expecting a port to have been assigned on which we can listen") - srv, err := grpcdb.NewServer(cert, key) - require.Nil(t, err) - defer srv.Stop() - go func() { - if err := srv.Serve(ln); err != nil { - panic(err) - } - }() - - client, err := remotedb.NewRemoteDB(ln.Addr().String(), cert) - require.Nil(t, err, "expecting a successful client creation") - dbName := "test-remote-db" - require.Nil(t, client.InitRemote(&remotedb.Init{Name: dbName, Type: "goleveldb"})) - defer os.RemoveAll(dbName + ".db") - - k1 := []byte("key-1") - v1, err := client.Get(k1) - require.NoError(t, err) - require.Equal(t, 0, len(v1), "expecting no key1 to have been stored, got %X (%s)", v1, v1) - vv1 := []byte("value-1") - err = client.Set(k1, vv1) - require.NoError(t, err) - - gv1, err := client.Get(k1) - require.NoError(t, err) - require.Equal(t, gv1, vv1) - - // Simple iteration - itr, err := client.Iterator(nil, nil) - require.NoError(t, err) - assert.True(t, itr.Valid()) - - key1 := itr.Key() - value := itr.Value() - - require.Equal(t, key1, []byte("key-1")) - require.Equal(t, value, []byte("value-1")) - itr.Close() - - // Set some more keys - k2 := []byte("key-2") - v2 := []byte("value-2") - err = client.SetSync(k2, v2) - require.NoError(t, err) - has, err := client.Has(k2) - require.NoError(t, err) - require.True(t, has) - gv2, err := client.Get(k2) - require.NoError(t, err) - require.Equal(t, gv2, v2) - - // More iteration - itr, err = client.Iterator(nil, nil) - require.NoError(t, err) - - key1 = itr.Key() - value = itr.Value() - - require.Equal(t, key1, []byte("key-1")) - require.Equal(t, value, []byte("value-1")) - itr.Next() - - key1 = itr.Key() - - value = itr.Value() - require.Equal(t, key1, []byte("key-2")) - require.Equal(t, value, []byte("value-2")) - itr.Close() - - // Deletion - err = client.Delete(k1) - require.NoError(t, err) - err = client.DeleteSync(k2) - require.NoError(t, err) - gv1, err = client.Get(k1) - require.NoError(t, err) - gv2, err = client.Get(k2) - require.NoError(t, err) - require.Equal(t, len(gv2), 0, "after deletion, not expecting the key to exist anymore") - require.Equal(t, len(gv1), 0, "after deletion, not expecting the key to exist anymore") - - // Batch tests - set - k3 := []byte("key-3") - k4 := []byte("key-4") - k5 := []byte("key-5") - v3 := []byte("value-3") - v4 := []byte("value-4") - v5 := []byte("value-5") - bat := client.NewBatch() - err = bat.Set(k3, v3) - require.NoError(t, err) - err = bat.Set(k4, v4) - require.NoError(t, err) - - rv3, err := client.Get(k3) - require.NoError(t, err) - require.Equal(t, 0, len(rv3), "expecting no k3 to have been stored") - - rv4, err := client.Get(k4) - require.NoError(t, err) - require.Equal(t, 0, len(rv4), "expecting no k4 to have been stored") - err = bat.Write() - require.NoError(t, err) - - rv3, err = client.Get(k3) - require.NoError(t, err) - require.Equal(t, rv3, v3, "expecting k3 to have been stored") - - rv4, err = client.Get(k4) - require.NoError(t, err) - require.Equal(t, rv4, v4, "expecting k4 to have been stored") - - // Batch tests - deletion - bat = client.NewBatch() - err = bat.Delete(k4) - require.NoError(t, err) - err = bat.Delete(k3) - require.NoError(t, err) - err = bat.WriteSync() - require.NoError(t, err) - - rv3, err = client.Get(k3) - require.NoError(t, err) - require.Equal(t, 0, len(rv3), "expecting k3 to have been deleted") - - rv4, err = client.Get(k4) - require.NoError(t, err) - require.Equal(t, 0, len(rv4), "expecting k4 to have been deleted") - - // Batch tests - set and delete - bat = client.NewBatch() - err = bat.Set(k4, v4) - require.NoError(t, err) - err = bat.Set(k5, v5) - require.NoError(t, err) - err = bat.Delete(k4) - require.NoError(t, err) - err = bat.WriteSync() - require.NoError(t, err) - - rv4, err = client.Get(k4) - require.NoError(t, err) - require.Equal(t, 0, len(rv4), "expecting k4 to have been deleted") - - rv5, err := client.Get(k5) - require.NoError(t, err) - require.Equal(t, rv5, v5, "expecting k5 to have been stored") -} diff --git a/remotedb/test.crt b/remotedb/test.crt deleted file mode 100644 index b3b203e37..000000000 --- a/remotedb/test.crt +++ /dev/null @@ -1,25 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEOjCCAiKgAwIBAgIQELi28YSz7wnGMCFY/LkGTDANBgkqhkiG9w0BAQsFADAZ -MRcwFQYDVQQDEw50ZW5kZXJtaW50LmNvbTAeFw0yMjA3MjYxMTQ1NTVaFw0yNDAx -MjYxMTQ1NTVaMBMxETAPBgNVBAMTCHJlbW90ZWRiMIIBIjANBgkqhkiG9w0BAQEF -AAOCAQ8AMIIBCgKCAQEA93GhF6GfEyh7VRBsLGlKMsG7rbE5Z6HjoMzWvURXjV2C -jsSfCmmVhv6UeaTQc8Wci7Sdabwm9eTiv1ikeY0ZYt+oZdcvhjXP4+so4yhPiBMk -II/Ds4VcojZ+aGXdbvhcdemFy0ZpvQ1nqJGdKgMt7CSExe8/Q06Xgy3JzlhlVMlb -KRC1OywwjxTxCjdA1MzmUG+P/4wYls0ejvco87UfSmaIm6GJwi3H9QlrtPAaI7JH -sZS1puR4JkA1xusBY1A5LeWLDaCmiSYh2x2NC7CiF23Fj5K4YQegQ1TsZxgS7pG1 -OZiAsa65V/pNXI3MAGk7k0Yb6Ai+IhzaczHAvhf4VQIDAQABo4GDMIGAMA4GA1Ud -DwEB/wQEAwIDuDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwHQYDVR0O -BBYEFKaGp/Pd8Iy9l+V5oeFAbv0MylOTMB8GA1UdIwQYMBaAFNSp7CXUG885Al3n -oJjlAZ0I+/yfMA8GA1UdEQQIMAaHBH8AAAEwDQYJKoZIhvcNAQELBQADggIBAHfM -odmek2HhUKzmqBSaLMHstyiGlxUDuUALfkJY8TNAtC02J9TIrAcT5dqT7zdKq3d5 -AldjBMcj3R9WlUPZv4prEvaLJSCpUilgGETVo4Q6EjTwplUiC558XspORF5WAZuB -73gxrz6rc8zUXDKcf0ey/kV/WOFS4ICjVhJMVa8hesd9JiQIqYnf0N1XrXk/YAqf -10lH+AWza5EsVH4sg45DVdwM45OxRIK1fQbSpBYczpT+UocGQWe1J2ehthFlh5Ab -V9OQ4TdJEdIs/p9WSZ9tmRlXJVvo2A9wWD3NOOSWiAXhKBBr5QsqNqaMjqQpajbT -STaQS3zeVAEYKdOUGy16ymfBm4nwcneDbwFOAGMahu3l/V4vlXA+Eb5tdSX1kwcf -l3ImQglBwwXTXPf1yyLXOVHFxqXTZI9fVOFB1qd4l76aGN0fBvnleqbhmXNohcVe -B/x/liaiGhL/udhDM7Y+dspw8LmNTGsqYGgYKmD3prFfWrkYcaRc32bPs9fk8hOz -e7vCQwSAbTEfXZ9/q7MwNcBG35iz37GJa9tV5Mg5UbJeZzj85PpnfIcCu6bmHlA9 -ROlJ8XF0TDqtvQrxz3WGaSm22DgkUP/Z+anCy+7E78dX1Ef+d1lg045PiHGijFIC -5NMT9dYCR7J3c6S6fDkSl0/iR0v5URCFJ7t2xjIC ------END CERTIFICATE----- diff --git a/remotedb/test.key b/remotedb/test.key deleted file mode 100644 index 15ada098c..000000000 --- a/remotedb/test.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEA93GhF6GfEyh7VRBsLGlKMsG7rbE5Z6HjoMzWvURXjV2CjsSf -CmmVhv6UeaTQc8Wci7Sdabwm9eTiv1ikeY0ZYt+oZdcvhjXP4+so4yhPiBMkII/D -s4VcojZ+aGXdbvhcdemFy0ZpvQ1nqJGdKgMt7CSExe8/Q06Xgy3JzlhlVMlbKRC1 -OywwjxTxCjdA1MzmUG+P/4wYls0ejvco87UfSmaIm6GJwi3H9QlrtPAaI7JHsZS1 -puR4JkA1xusBY1A5LeWLDaCmiSYh2x2NC7CiF23Fj5K4YQegQ1TsZxgS7pG1OZiA -sa65V/pNXI3MAGk7k0Yb6Ai+IhzaczHAvhf4VQIDAQABAoIBAQC2tuA2O/Djy6uu -d275KFJSwn2cV1ZFMOSN01Pp9DIWP+ttEsFBhg+U3B206T/HjS74dkkaT4YRYo8Q -rhrdapRJT0/gy5HbL5cv/HB3tEdt+nxd0uq2gA6T9VtIKZfmHlzf8K0MGhVwNRrK -/aMo56ocSicEpZJ4V+tHQSNYTCue+5CzAsBzebh96/F0xx7Tb9AkjE3P0IPtgBgq -z0xT8rZxlxwDXgS1kw0EGGCFAFInJTziOqgS7rI6A6mznxNYAgWitziBiQrljXQj -3zssbt+nQ5iZLlICRBMgZXzOmI5nH5EXqYY+ZPANHpzb52MCMrA/3VNfxQj0OHth -ELH1BoptAoGBAPtRKv7hd+B6DXyuNZNpx33ELrS1dFC/1mtAN+6hBXDbTyYrNpcb -83BDP7l8W8RIZyh/6iG2lc8VQQxYHUPqHVfUSn4MLxFvF1vrxuROaCleSy2TXcwS -FFtBaBF8Mz2Gpnojhpu7jZ5FcG0gJ+oScRTSzCwY/Ko/Q1VaiZfOWAVjAoGBAPwN -/ELfkp2VNZY46NUQVhFMMbGI34XJ1W7oe63GwnrkRIbAqs7/Kj3tD3vy3PNgB1HK -ZERAgq/a4rwaOl2YvcAhTKgkYEbHpdz0ktv9qu3ShqJOpD1wOAGKmE8XXXuu/unw -/ScXqWwFH/bqs+/wktmzJHWWbmOOy1LX8DhwETTnAoGANFI1rVKrbmR6olZyePow -uhI51w1f5d/KeBGqk1ealmBSHhQpDVSYXeriPW+Se07Hizr2N4aXscEvBa7iiN0Y -tsxPpeZLdkm2h0CS670XGmWzKQ3hHTc2XblEPT+qO0jpJ8x1nb5yQV0bhtyG8shc -GoW4VAXvtFHvZrmuo5gl4xkCgYEA+YwLJlZdvWC9xjYf5tqeq8+JH6FI1BfJFV5d -HOa9I5iec9+K/RfKRbdP7kK8GMUJWiQMczp/aQZIFz3MbWBM9UzCrXIeU9VUVNdc -Eywpr/4QR9+eYimZeYUzWJLkfhD61rk+mhamKYlFZVxnu/WuHpVrUnQWZME6cpHS -hr4Fex8CgYEA1ma2f7DppXXZYEReqedsf+sN5/7KmnEH4H/f/7SAPLBLTJhV9zua -Mv3ur8wZH1NOb36o0jzFGdwXqjF1ubbJihKcJHz658q6lVbnaREa1NenZiVrm7H6 -SOHxWjPSvyUoj91ci4/5xeVWWtX2YyGHSMfJs5h4PNBVQPfON+uIhwQ= ------END RSA PRIVATE KEY----- diff --git a/rocksdb.go b/rocksdb.go deleted file mode 100644 index 4994ecad5..000000000 --- a/rocksdb.go +++ /dev/null @@ -1,187 +0,0 @@ -//go:build rocksdb -// +build rocksdb - -package db - -import ( - "fmt" - "path/filepath" - "runtime" - - "github.com/cosmos/gorocksdb" -) - -func init() { - dbCreator := func(name string, dir string) (DB, error) { - return NewRocksDB(name, dir) - } - registerDBCreator(RocksDBBackend, dbCreator, false) -} - -// RocksDB is a RocksDB backend. -type RocksDB struct { - db *gorocksdb.DB - ro *gorocksdb.ReadOptions - wo *gorocksdb.WriteOptions - woSync *gorocksdb.WriteOptions -} - -var _ DB = (*RocksDB)(nil) - -func NewRocksDB(name string, dir string) (*RocksDB, error) { - // default rocksdb option, good enough for most cases, including heavy workloads. - // 1GB table cache, 512MB write buffer(may use 50% more on heavy workloads). - // compression: snappy as default, need to -lsnappy to enable. - bbto := gorocksdb.NewDefaultBlockBasedTableOptions() - bbto.SetBlockCache(gorocksdb.NewLRUCache(1 << 30)) - bbto.SetFilterPolicy(gorocksdb.NewBloomFilter(10)) - - opts := gorocksdb.NewDefaultOptions() - opts.SetBlockBasedTableFactory(bbto) - // SetMaxOpenFiles to 4096 seems to provide a reliable performance boost - opts.SetMaxOpenFiles(4096) - opts.SetCreateIfMissing(true) - opts.IncreaseParallelism(runtime.NumCPU()) - // 1.5GB maximum memory use for writebuffer. - opts.OptimizeLevelStyleCompaction(512 * 1024 * 1024) - return NewRocksDBWithOptions(name, dir, opts) -} - -func NewRocksDBWithOptions(name string, dir string, opts *gorocksdb.Options) (*RocksDB, error) { - dbPath := filepath.Join(dir, name+".db") - db, err := gorocksdb.OpenDb(opts, dbPath) - if err != nil { - return nil, err - } - ro := gorocksdb.NewDefaultReadOptions() - wo := gorocksdb.NewDefaultWriteOptions() - woSync := gorocksdb.NewDefaultWriteOptions() - woSync.SetSync(true) - database := &RocksDB{ - db: db, - ro: ro, - wo: wo, - woSync: woSync, - } - return database, nil -} - -// Get implements DB. -func (db *RocksDB) Get(key []byte) ([]byte, error) { - if len(key) == 0 { - return nil, errKeyEmpty - } - res, err := db.db.Get(db.ro, key) - if err != nil { - return nil, err - } - return moveSliceToBytes(res), nil -} - -// Has implements DB. -func (db *RocksDB) Has(key []byte) (bool, error) { - bytes, err := db.Get(key) - if err != nil { - return false, err - } - return bytes != nil, nil -} - -// Set implements DB. -func (db *RocksDB) Set(key []byte, value []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if value == nil { - return errValueNil - } - return db.db.Put(db.wo, key, value) -} - -// SetSync implements DB. -func (db *RocksDB) SetSync(key []byte, value []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if value == nil { - return errValueNil - } - return db.db.Put(db.woSync, key, value) -} - -// Delete implements DB. -func (db *RocksDB) Delete(key []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - return db.db.Delete(db.wo, key) -} - -// DeleteSync implements DB. -func (db *RocksDB) DeleteSync(key []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - return db.db.Delete(db.woSync, key) -} - -func (db *RocksDB) DB() *gorocksdb.DB { - return db.db -} - -// Close implements DB. -func (db *RocksDB) Close() error { - db.ro.Destroy() - db.wo.Destroy() - db.woSync.Destroy() - db.db.Close() - return nil -} - -// Print implements DB. -func (db *RocksDB) Print() error { - itr, err := db.Iterator(nil, nil) - if err != nil { - return err - } - defer itr.Close() - for ; itr.Valid(); itr.Next() { - key := itr.Key() - value := itr.Value() - fmt.Printf("[%X]:\t[%X]\n", key, value) - } - return nil -} - -// Stats implements DB. -func (db *RocksDB) Stats() map[string]string { - keys := []string{"rocksdb.stats"} - stats := make(map[string]string, len(keys)) - for _, key := range keys { - stats[key] = db.db.GetProperty(key) - } - return stats -} - -// NewBatch implements DB. -func (db *RocksDB) NewBatch() Batch { - return newRocksDBBatch(db) -} - -// Iterator implements DB. -func (db *RocksDB) Iterator(start, end []byte) (Iterator, error) { - if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, errKeyEmpty - } - itr := db.db.NewIterator(db.ro) - return newRocksDBIterator(itr, start, end, false), nil -} - -// ReverseIterator implements DB. -func (db *RocksDB) ReverseIterator(start, end []byte) (Iterator, error) { - if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, errKeyEmpty - } - itr := db.db.NewIterator(db.ro) - return newRocksDBIterator(itr, start, end, true), nil -} diff --git a/rocksdb_batch.go b/rocksdb_batch.go deleted file mode 100644 index b2557ac45..000000000 --- a/rocksdb_batch.go +++ /dev/null @@ -1,83 +0,0 @@ -//go:build rocksdb -// +build rocksdb - -package db - -import "github.com/cosmos/gorocksdb" - -type rocksDBBatch struct { - db *RocksDB - batch *gorocksdb.WriteBatch -} - -var _ Batch = (*rocksDBBatch)(nil) - -func newRocksDBBatch(db *RocksDB) *rocksDBBatch { - return &rocksDBBatch{ - db: db, - batch: gorocksdb.NewWriteBatch(), - } -} - -// Set implements Batch. -func (b *rocksDBBatch) Set(key, value []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if value == nil { - return errValueNil - } - if b.batch == nil { - return errBatchClosed - } - b.batch.Put(key, value) - return nil -} - -// Delete implements Batch. -func (b *rocksDBBatch) Delete(key []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if b.batch == nil { - return errBatchClosed - } - b.batch.Delete(key) - return nil -} - -// Write implements Batch. -func (b *rocksDBBatch) Write() error { - if b.batch == nil { - return errBatchClosed - } - err := b.db.db.Write(b.db.wo, b.batch) - if err != nil { - return err - } - // Make sure batch cannot be used afterwards. Callers should still call Close(), for errors. - b.Close() - return nil -} - -// WriteSync implements Batch. -func (b *rocksDBBatch) WriteSync() error { - if b.batch == nil { - return errBatchClosed - } - err := b.db.db.Write(b.db.woSync, b.batch) - if err != nil { - return err - } - // Make sure batch cannot be used afterwards. Callers should still call Close(), for errors. - return b.Close() -} - -// Close implements Batch. -func (b *rocksDBBatch) Close() error { - if b.batch != nil { - b.batch.Destroy() - b.batch = nil - } - return nil -} diff --git a/rocksdb_iterator.go b/rocksdb_iterator.go deleted file mode 100644 index e79a76cd6..000000000 --- a/rocksdb_iterator.go +++ /dev/null @@ -1,146 +0,0 @@ -//go:build rocksdb -// +build rocksdb - -package db - -import ( - "bytes" - - "github.com/cosmos/gorocksdb" -) - -type rocksDBIterator struct { - source *gorocksdb.Iterator - start, end []byte - isReverse bool - isInvalid bool -} - -var _ Iterator = (*rocksDBIterator)(nil) - -func newRocksDBIterator(source *gorocksdb.Iterator, start, end []byte, isReverse bool) *rocksDBIterator { - if isReverse { - if end == nil { - source.SeekToLast() - } else { - source.Seek(end) - if source.Valid() { - eoakey := moveSliceToBytes(source.Key()) // end or after key - if bytes.Compare(end, eoakey) <= 0 { - source.Prev() - } - } else { - source.SeekToLast() - } - } - } else { - if start == nil { - source.SeekToFirst() - } else { - source.Seek(start) - } - } - return &rocksDBIterator{ - source: source, - start: start, - end: end, - isReverse: isReverse, - isInvalid: false, - } -} - -// Domain implements Iterator. -func (itr *rocksDBIterator) Domain() ([]byte, []byte) { - return itr.start, itr.end -} - -// Valid implements Iterator. -func (itr *rocksDBIterator) Valid() bool { - // Once invalid, forever invalid. - if itr.isInvalid { - return false - } - - // If source has error, invalid. - if err := itr.source.Err(); err != nil { - itr.isInvalid = true - return false - } - - // If source is invalid, invalid. - if !itr.source.Valid() { - itr.isInvalid = true - return false - } - - // If key is end or past it, invalid. - start := itr.start - end := itr.end - key := moveSliceToBytes(itr.source.Key()) - if itr.isReverse { - if start != nil && bytes.Compare(key, start) < 0 { - itr.isInvalid = true - return false - } - } else { - if end != nil && bytes.Compare(end, key) <= 0 { - itr.isInvalid = true - return false - } - } - - // It's valid. - return true -} - -// Key implements Iterator. -func (itr *rocksDBIterator) Key() []byte { - itr.assertIsValid() - return moveSliceToBytes(itr.source.Key()) -} - -// Value implements Iterator. -func (itr *rocksDBIterator) Value() []byte { - itr.assertIsValid() - return moveSliceToBytes(itr.source.Value()) -} - -// Next implements Iterator. -func (itr rocksDBIterator) Next() { - itr.assertIsValid() - if itr.isReverse { - itr.source.Prev() - } else { - itr.source.Next() - } -} - -// Error implements Iterator. -func (itr *rocksDBIterator) Error() error { - return itr.source.Err() -} - -// Close implements Iterator. -func (itr *rocksDBIterator) Close() error { - itr.source.Close() - return nil -} - -func (itr *rocksDBIterator) assertIsValid() { - if !itr.Valid() { - panic("iterator is invalid") - } -} - -// moveSliceToBytes will free the slice and copy out a go []byte -// This function can be applied on *Slice returned from Key() and Value() -// of an Iterator, because they are marked as freed. -func moveSliceToBytes(s *gorocksdb.Slice) []byte { - defer s.Free() - if !s.Exists() { - return nil - } - v := make([]byte, len(s.Data())) - copy(v, s.Data()) - return v -} diff --git a/rocksdb_test.go b/rocksdb_test.go deleted file mode 100644 index bd6793420..000000000 --- a/rocksdb_test.go +++ /dev/null @@ -1,47 +0,0 @@ -//go:build rocksdb -// +build rocksdb - -package db - -import ( - "fmt" - "os" - "path/filepath" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestRocksDBBackend(t *testing.T) { - name := fmt.Sprintf("test_%x", randStr(12)) - dir := os.TempDir() - db, err := NewDB(name, RocksDBBackend, dir) - require.NoError(t, err) - defer cleanupDBDir(dir, name) - - _, ok := db.(*RocksDB) - assert.True(t, ok) -} - -func TestWithRocksDB(t *testing.T) { - dir := t.TempDir() - path := filepath.Join(dir, "rocksdb") - - db, err := NewRocksDB(path, "") - require.NoError(t, err) - - t.Run("RocksDB", func(t *testing.T) { Run(t, db) }) -} - -func TestRocksDBStats(t *testing.T) { - name := fmt.Sprintf("test_%x", randStr(12)) - dir := os.TempDir() - db, err := NewDB(name, RocksDBBackend, dir) - require.NoError(t, err) - defer cleanupDBDir(dir, name) - - assert.NotEmpty(t, db.Stats()) -} - -// TODO: Add tests for rocksdb diff --git a/tools/Dockerfile b/tools/Dockerfile deleted file mode 100644 index 855414aab..000000000 --- a/tools/Dockerfile +++ /dev/null @@ -1,44 +0,0 @@ -# This file defines the container image used to build and test tm-db in CI. -# The CI workflows use the latest tag of tendermintdev/docker-tm-db-testing -# built from these settings. -# -# The jobs defined in the Build & Push workflow will build and update the image -# when changes to this file are merged. If you have other changes that require -# updates here, merge the changes here first and let the image get updated (or -# push a new version manually) before PRs that depend on them. - -FROM golang:1.17-bullseye AS build - -ENV LD_LIBRARY_PATH=/usr/local/lib - -RUN apt-get update && apt-get install -y --no-install-recommends \ - libbz2-dev libgflags-dev libsnappy-dev libzstd-dev zlib1g-dev \ - make tar wget - -FROM build AS install -ARG LEVELDB=1.20 -ARG ROCKSDB=6.24.2 - -# Install cleveldb -RUN \ - wget -q https://github.com/google/leveldb/archive/v${LEVELDB}.tar.gz \ - && tar xvf v${LEVELDB}.tar.gz \ - && cd leveldb-${LEVELDB} \ - && make \ - && cp -a out-static/lib* out-shared/lib* /usr/local/lib \ - && cd include \ - && cp -a leveldb /usr/local/include \ - && ldconfig \ - && cd ../.. \ - && rm -rf v${LEVELDB}.tar.gz leveldb-${LEVELDB} - -# Install Rocksdb -RUN \ - wget -q https://github.com/facebook/rocksdb/archive/v${ROCKSDB}.tar.gz \ - && tar -zxf v${ROCKSDB}.tar.gz \ - && cd rocksdb-${ROCKSDB} \ - && DEBUG_LEVEL=0 make -j4 shared_lib \ - && make install-shared \ - && ldconfig \ - && cd .. \ - && rm -rf v${ROCKSDB}.tar.gz rocksdb-${ROCKSDB} From 427f8a54ca2acbae01bed9ac02461900ff6e1c1c Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 8 Nov 2022 23:19:30 +0700 Subject: [PATCH 15/26] fix gaia test --- .github/workflows/gaia.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/gaia.yml b/.github/workflows/gaia.yml index b1c5ef517..688e1a1b9 100644 --- a/.github/workflows/gaia.yml +++ b/.github/workflows/gaia.yml @@ -11,7 +11,6 @@ on: pull_request: push: - jobs: build: runs-on: ubuntu-latest @@ -24,13 +23,10 @@ jobs: GAIAD_P2P_SEEDS: "bf8328b66dceb4987e5cd94430af66045e59899f@public-seed.cosmos.vitwit.com:26656,cfd785a4224c7940e9a10f6c1ab24c343e923bec@164.68.107.188:26656,d72b3011ed46d783e369fdf8ae2055b99a1e5074@173.249.50.25:26656,ba3bacc714817218562f743178228f23678b2873@public-seed-node.cosmoshub.certus.one:26656,3c7cad4154967a294b3ba1cc752e40e8779640ad@84.201.128.115:26656,366ac852255c3ac8de17e11ae9ec814b8c68bddb@51.15.94.196:26656" GAIAD_STATESYNC_RPC_SERVERS: "https://cosmoshub.validator.network:443,https://cosmoshub.validator.network:443" GOPATH: /go - - - - strategy: + strategy: matrix: - database: [rocksdb, pebbledb, boltdb, badgerdb, goleveldb, cleveldb] + database: [pebbledb, goleveldb] steps: - run: git config --global --add safe.directory /__w/tendermint/tm-db @@ -54,5 +50,3 @@ jobs: gaiad init gaia-matrix cp /genesis.json ~/.gaia/config/genesis.json gaiad start --x-crisis-skip-assert-invariants --db_backend ${{ matrix.database }} - - \ No newline at end of file From 7a98b7736fd23165d9ab405beb3391fbcedbd5a9 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 8 Nov 2022 23:21:24 +0700 Subject: [PATCH 16/26] remove ioutil --- backend_test.go | 5 ++--- common_test.go | 4 ++-- types.go | 15 ++++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/backend_test.go b/backend_test.go index aecae4bf5..e621ecd1b 100644 --- a/backend_test.go +++ b/backend_test.go @@ -2,7 +2,6 @@ package db import ( "fmt" - "io/ioutil" "os" "path/filepath" "testing" @@ -35,7 +34,7 @@ func cleanupDBDir(dir, name string) { func testBackendGetSetDelete(t *testing.T, backend BackendType) { // Default - dirname, err := ioutil.TempDir("", fmt.Sprintf("test_backend_%s_", backend)) + dirname, err := os.MkdirTemp("", fmt.Sprintf("test_backend_%s_", backend)) require.Nil(t, err) db, err := NewDB("testdb", backend, dirname) require.NoError(t, err) @@ -302,7 +301,7 @@ func testDBIterator(t *testing.T, backend BackendType) { []int64(nil), "reverse iterator from 2 (ex) to 4") // Ensure that the iterators don't panic with an empty database. - dir2, err := ioutil.TempDir("", "tm-db-test") + dir2, err := os.MkdirTemp("", "tm-db-test") require.NoError(t, err) db2, err := NewDB(name, backend, dir2) require.NoError(t, err) diff --git a/common_test.go b/common_test.go index e73a2fc5e..b01f910b6 100644 --- a/common_test.go +++ b/common_test.go @@ -3,8 +3,8 @@ package db import ( "bytes" "encoding/binary" - "io/ioutil" "math/rand" + "os" "testing" "github.com/stretchr/testify/assert" @@ -67,7 +67,7 @@ func checkValuePanics(t *testing.T, itr Iterator) { } func newTempDB(t *testing.T, backend BackendType) (db DB, dbDir string) { - dirname, err := ioutil.TempDir("", "db_common_test") + dirname, err := os.MkdirTemp("", "db_common_test") require.NoError(t, err) db, err = NewDB("testdb", backend, dirname) require.NoError(t, err) diff --git a/types.go b/types.go index 3be412fd2..131174d0d 100644 --- a/types.go +++ b/types.go @@ -111,13 +111,14 @@ type Batch interface { // var itr Iterator = ... // defer itr.Close() // -// for ; itr.Valid(); itr.Next() { -// k, v := itr.Key(); itr.Value() -// ... -// } -// if err := itr.Error(); err != nil { -// ... -// } +// for ; itr.Valid(); itr.Next() { +// k, v := itr.Key(); itr.Value() +// ... +// } +// +// if err := itr.Error(); err != nil { +// ... +// } type Iterator interface { // Domain returns the start (inclusive) and end (exclusive) limits of the iterator. // CONTRACT: start, end readonly []byte From 519f06951f20b9535a19effe7c89836ff3029422 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 8 Nov 2022 23:23:29 +0700 Subject: [PATCH 17/26] no need for docker --- .github/workflows/docker.yml | 56 ------------------------------------ 1 file changed, 56 deletions(-) delete mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 1d8a560b3..000000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,56 +0,0 @@ -# This workflow builds and pushes a new version of the build container image -# when the tools directory changes on master. Edit tools/Dockerfile. -# -# This workflow does not push a new image until it is merged, so tests that -# depend on changes in this image will not pass until this workflow succeeds. -# For that reason, changes here should be done in a separate PR in advance of -# work that depends on them. - -name: Build & Push TM-DB-Testing -on: - pull_request: - paths: - - "tools/*" - push: - branches: - - master - paths: - - "tools/*" - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Prepare - id: prep - run: | - DOCKER_IMAGE=tendermintdev/docker-tm-db-testing - VERSION=noop - if [[ $GITHUB_REF == refs/tags/* ]]; then - VERSION=${GITHUB_REF#refs/tags/} - elif [[ $GITHUB_REF == refs/heads/* ]]; then - VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g') - if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then - VERSION=latest - fi - fi - TAGS="${DOCKER_IMAGE}:${VERSION}" - echo ::set-output name=tags::${TAGS} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Publish to Docker Hub - uses: docker/build-push-action@v3 - with: - context: ./tools - file: ./tools/Dockerfile - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.prep.outputs.tags }} From 082b066951b0da24176e0ef89061a6a7d2d82ddc Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 8 Nov 2022 23:25:50 +0700 Subject: [PATCH 18/26] statesync --- .github/workflows/gaia.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gaia.yml b/.github/workflows/gaia.yml index 688e1a1b9..5e29f21c6 100644 --- a/.github/workflows/gaia.yml +++ b/.github/workflows/gaia.yml @@ -34,7 +34,7 @@ jobs: - name: state sync gaia with ${{ matrix.database }} run: | cd .. - git clone https://github.com/cosmos/gaia + git clone https://github.com/cosmos/gaia --branch release/v7.1.0 cd gaia go mod edit -replace github.com/tendermint/tm-db=../tm-db go mod tidy From 164d292a68369e50c968301f1c6657ac935a47bc Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 8 Nov 2022 23:27:34 +0700 Subject: [PATCH 19/26] fix gaia ver --- .github/workflows/gaia.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gaia.yml b/.github/workflows/gaia.yml index 5e29f21c6..6520002f1 100644 --- a/.github/workflows/gaia.yml +++ b/.github/workflows/gaia.yml @@ -34,7 +34,7 @@ jobs: - name: state sync gaia with ${{ matrix.database }} run: | cd .. - git clone https://github.com/cosmos/gaia --branch release/v7.1.0 + git clone https://github.com/cosmos/gaia --branch release/v7.0.x cd gaia go mod edit -replace github.com/tendermint/tm-db=../tm-db go mod tidy From 4850b08f16517a510fe90b4b0dcf4d0dbcf91e68 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 8 Nov 2022 23:32:42 +0700 Subject: [PATCH 20/26] update rpc --- .github/workflows/gaia.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gaia.yml b/.github/workflows/gaia.yml index 6520002f1..3677e8cdb 100644 --- a/.github/workflows/gaia.yml +++ b/.github/workflows/gaia.yml @@ -39,9 +39,9 @@ jobs: go mod edit -replace github.com/tendermint/tm-db=../tm-db go mod tidy go install -ldflags '-w -s -X github.com/cosmos/cosmos-sdk/types.DBBackend=${{ matrix.database }}' -tags ${{ matrix.database }} ./... - export LATEST_HEIGHT=$(curl -s https://cosmoshub.validator.network/block | jq -r .result.block.header.height); + export LATEST_HEIGHT=$(curl -s https://rpc-cosmoshub.blockapsis.com/block | jq -r .result.block.header.height); export BLOCK_HEIGHT=$(($LATEST_HEIGHT-$INTERVAL)) - export TRUST_HASH=$(curl -s "https://cosmoshub.validator.network/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash) + export TRUST_HASH=$(curl -s "https://rpc-cosmoshub.blockapsis.com/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash) export GAIAD_STATESYNC_TRUST_HEIGHT=$BLOCK_HEIGHT export GAIAD_STATESYNC_TRUST_HASH=$TRUST_HASH export PATH=$PATH:/go/bin From 9d3a17c3adb42ff470816f63788d28dd4e59f2af Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 8 Nov 2022 23:37:18 +0700 Subject: [PATCH 21/26] racing gaias --- .github/workflows/gaia.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gaia.yml b/.github/workflows/gaia.yml index 3677e8cdb..e46964da8 100644 --- a/.github/workflows/gaia.yml +++ b/.github/workflows/gaia.yml @@ -21,7 +21,7 @@ jobs: GAIAD_STATESYNC_ENABLE: true GAIAD_P2P_MAX_NUM_OUTBOUND_PEERS: 200 GAIAD_P2P_SEEDS: "bf8328b66dceb4987e5cd94430af66045e59899f@public-seed.cosmos.vitwit.com:26656,cfd785a4224c7940e9a10f6c1ab24c343e923bec@164.68.107.188:26656,d72b3011ed46d783e369fdf8ae2055b99a1e5074@173.249.50.25:26656,ba3bacc714817218562f743178228f23678b2873@public-seed-node.cosmoshub.certus.one:26656,3c7cad4154967a294b3ba1cc752e40e8779640ad@84.201.128.115:26656,366ac852255c3ac8de17e11ae9ec814b8c68bddb@51.15.94.196:26656" - GAIAD_STATESYNC_RPC_SERVERS: "https://cosmoshub.validator.network:443,https://cosmoshub.validator.network:443" + GAIAD_STATESYNC_RPC_SERVERS: "https://rpc-cosmoshub.blockapsis.com:443,https://cosmoshub.validator.network:443" GOPATH: /go strategy: From 4598d072c6de36dff841e285c5b7cbe7efc181f6 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 8 Nov 2022 23:38:26 +0700 Subject: [PATCH 22/26] make them stop --- .github/workflows/gaia.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gaia.yml b/.github/workflows/gaia.yml index e46964da8..b5b89b63a 100644 --- a/.github/workflows/gaia.yml +++ b/.github/workflows/gaia.yml @@ -49,4 +49,4 @@ jobs: echo "TRUST HASH: $TRUST_HASH" gaiad init gaia-matrix cp /genesis.json ~/.gaia/config/genesis.json - gaiad start --x-crisis-skip-assert-invariants --db_backend ${{ matrix.database }} + gaiad start --x-crisis-skip-assert-invariants --db_backend ${{ matrix.database }} --halt-height $((LATEST_HEIGHT+25)) From 59979d7a329305aee03294e2e072db7c50fb8d51 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 8 Nov 2022 23:44:55 +0700 Subject: [PATCH 23/26] polka --- .github/workflows/gaia.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gaia.yml b/.github/workflows/gaia.yml index b5b89b63a..900f7ec97 100644 --- a/.github/workflows/gaia.yml +++ b/.github/workflows/gaia.yml @@ -20,7 +20,7 @@ jobs: INTERVAL: 1000 GAIAD_STATESYNC_ENABLE: true GAIAD_P2P_MAX_NUM_OUTBOUND_PEERS: 200 - GAIAD_P2P_SEEDS: "bf8328b66dceb4987e5cd94430af66045e59899f@public-seed.cosmos.vitwit.com:26656,cfd785a4224c7940e9a10f6c1ab24c343e923bec@164.68.107.188:26656,d72b3011ed46d783e369fdf8ae2055b99a1e5074@173.249.50.25:26656,ba3bacc714817218562f743178228f23678b2873@public-seed-node.cosmoshub.certus.one:26656,3c7cad4154967a294b3ba1cc752e40e8779640ad@84.201.128.115:26656,366ac852255c3ac8de17e11ae9ec814b8c68bddb@51.15.94.196:26656" + GAIAD_P2P_SEEDS: "ade4d8bc8cbe014af6ebdf3cb7b1e9ad36f412c0@seeds.polkachu.com:14956" GAIAD_STATESYNC_RPC_SERVERS: "https://rpc-cosmoshub.blockapsis.com:443,https://cosmoshub.validator.network:443" GOPATH: /go From b9f9d09143be6843a240a459e24651a38b20e1e7 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 8 Nov 2022 23:51:29 +0700 Subject: [PATCH 24/26] polka2 --- .github/workflows/gaia.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gaia.yml b/.github/workflows/gaia.yml index 900f7ec97..f8d520f54 100644 --- a/.github/workflows/gaia.yml +++ b/.github/workflows/gaia.yml @@ -21,7 +21,7 @@ jobs: GAIAD_STATESYNC_ENABLE: true GAIAD_P2P_MAX_NUM_OUTBOUND_PEERS: 200 GAIAD_P2P_SEEDS: "ade4d8bc8cbe014af6ebdf3cb7b1e9ad36f412c0@seeds.polkachu.com:14956" - GAIAD_STATESYNC_RPC_SERVERS: "https://rpc-cosmoshub.blockapsis.com:443,https://cosmoshub.validator.network:443" + GAIAD_STATESYNC_RPC_SERVERS: "https://cosmos-rpc.polkachu.com:443,https://rpc-cosmoshub.blockapsis.com:443,https://cosmoshub.validator.network:443" GOPATH: /go strategy: From 4ce4a7804fe4a67531f35c2843386394cb096630 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 9 Nov 2022 00:21:13 +0700 Subject: [PATCH 25/26] cleanup --- db.go | 6 ++++-- go.mod | 4 +--- go.sum | 2 +- util_test.go | 5 ----- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/db.go b/db.go index 586569dab..a4714b40e 100644 --- a/db.go +++ b/db.go @@ -18,11 +18,13 @@ const ( // - EXPERIMENTAL // - use pebble build tag (go build -tags pebbledb) PebbleDBBackend BackendType = "pebbledb" - // MDBXBackend represents mdbx (uses mdbx) + // MDBXBackend represents mdbx (uses mdbx) // - EXPERIMENTAL // - use pebble build tag (go build -tags mdbx) - MDBXBackend BackendType = "mdbx" + // MemDBBackend represents in-memory key value store, which is mostly used + // for testing. + MemDBBackend BackendType = "memdb" ) type dbCreator func(name string, dir string) (DB, error) diff --git a/go.mod b/go.mod index 0722fa81c..e020b412e 100644 --- a/go.mod +++ b/go.mod @@ -3,14 +3,12 @@ module github.com/tendermint/tm-db go 1.19 require ( - github.com/cockroachdb/pebble v0.0.0-20220726134658-7b78c71e4055 github.com/c2h5oh/datasize v0.0.0-20220606134207-859f65c6625b - github.com/gogo/protobuf v1.3.2 + github.com/cockroachdb/pebble v0.0.0-20220726134658-7b78c71e4055 github.com/google/btree v1.1.2 github.com/stretchr/testify v1.8.0 github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca github.com/torquem-ch/mdbx-go v0.26.0 - google.golang.org/grpc v1.48.0 ) require ( diff --git a/go.sum b/go.sum index e6285bd1c..ede7cac74 100644 --- a/go.sum +++ b/go.sum @@ -209,9 +209,9 @@ github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PK github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/torquem-ch/mdbx-go v0.26.0 h1:d8ph2MsVZoBZr0eFWHRiSYjoCXggED6XzcspUX/HsZM= github.com/torquem-ch/mdbx-go v0.26.0/go.mod h1:T2fsoJDVppxfAPTLd1svUgH1kpPmeXdPESmroSHcL1E= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= diff --git a/util_test.go b/util_test.go index 411abe1ee..68e6b8e40 100644 --- a/util_test.go +++ b/util_test.go @@ -25,11 +25,6 @@ func TestPrefixIteratorNoMatchNil(t *testing.T) { // Empty iterator for db populated after iterator created. func TestPrefixIteratorNoMatch1(t *testing.T) { for backend := range backends { - if backend == BoltDBBackend { - t.Log("bolt does not support concurrent writes while iterating") - continue - } - t.Run(fmt.Sprintf("Prefix w/ backend %s", backend), func(t *testing.T) { db, dir := newTempDB(t, backend) defer os.RemoveAll(dir) From fc66e001a84c540685f4f95f53599f81e4775e59 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 9 Nov 2022 00:26:52 +0700 Subject: [PATCH 26/26] test mdbx --- .github/workflows/gaia.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gaia.yml b/.github/workflows/gaia.yml index f8d520f54..0f50bbf1a 100644 --- a/.github/workflows/gaia.yml +++ b/.github/workflows/gaia.yml @@ -26,7 +26,7 @@ jobs: strategy: matrix: - database: [pebbledb, goleveldb] + database: [pebbledb, goleveldb, mdbx] steps: - run: git config --global --add safe.directory /__w/tendermint/tm-db