Skip to content

Commit

Permalink
Merge pull request gnolang#3 from ilgooz/ilgooz/wasm-additions
Browse files Browse the repository at this point in the history
chore: switch to `gnolang/goleveldb` and cleanup
  • Loading branch information
moul committed Aug 2, 2023
2 parents f2d6709 + a535c75 commit 0482c08
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 59 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/fortytw2/leaktest v1.3.0
github.com/gdamore/tcell/v2 v2.1.0
github.com/gnolang/cors v1.8.1
github.com/gnolang/goleveldb v0.0.0-20230801134443-a29c535aa920
github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216
github.com/golang/protobuf v1.5.3
github.com/google/gofuzz v1.2.0
Expand All @@ -27,7 +28,6 @@ require (
github.com/peterbourgon/ff/v3 v3.4.0
github.com/pmezard/go-difflib v1.0.0
github.com/stretchr/testify v1.8.4
github.com/syndtr/goleveldb v1.0.0
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c
go.etcd.io/bbolt v1.3.7
go.uber.org/multierr v1.9.0
Expand All @@ -52,7 +52,7 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/flatbuffers v1.12.1 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/gorilla/sessions v1.2.1 // indirect
Expand Down
52 changes: 43 additions & 9 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion misc/deployments/staging.gno.land/overlay/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ moniker = "45-79-178-97"
fast_sync = true

# Database backend: goleveldb | cleveldb | boltdb
# * goleveldb (github.com/syndtr/goleveldb - most popular implementation)
# * goleveldb (github.com/gnolang/goleveldb, fork of github.com/syndtr/goleveldb) - most popular implementation)
# - pure go
# - stable
# * cleveldb (uses levigo wrapper)
Expand Down
2 changes: 1 addition & 1 deletion misc/deployments/test2.gno.land/overlay/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ moniker = "45-79-178-97"
fast_sync = true

# Database backend: goleveldb | cleveldb | boltdb
# * goleveldb (github.com/syndtr/goleveldb - most popular implementation)
# * goleveldb (github.com/gnolang/goleveldb - most popular implementation)
# - pure go
# - stable
# * cleveldb (uses levigo wrapper)
Expand Down
2 changes: 1 addition & 1 deletion misc/deployments/test3.gno.land/overlay/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ moniker = "45-79-178-97"
fast_sync = true

# Database backend: goleveldb | cleveldb | boltdb
# * goleveldb (github.com/syndtr/goleveldb - most popular implementation)
# * goleveldb (github.com/gnolang/goleveldb - most popular implementation)
# - pure go
# - stable
# * cleveldb (uses levigo wrapper)
Expand Down
8 changes: 0 additions & 8 deletions tm2/pkg/bft/abci/example/kvstore/os_default.go

This file was deleted.

8 changes: 0 additions & 8 deletions tm2/pkg/bft/abci/example/kvstore/os_wasm.go

This file was deleted.

2 changes: 1 addition & 1 deletion tm2/pkg/bft/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ type BaseConfig struct {
FastSyncMode bool `toml:"fast_sync"`

// Database backend: goleveldb | cleveldb | boltdb
// * goleveldb (github.com/syndtr/goleveldb - most popular implementation)
// * goleveldb (github.com/gnolang/goleveldb - most popular implementation)
// - pure go
// - stable
// * cleveldb (uses levigo wrapper)
Expand Down
2 changes: 1 addition & 1 deletion tm2/pkg/bft/config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ moniker = "{{ .BaseConfig.Moniker }}"
fast_sync = {{ .BaseConfig.FastSyncMode }}
# Database backend: goleveldb | cleveldb | boltdb
# * goleveldb (github.com/syndtr/goleveldb - most popular implementation)
# * goleveldb (github.com/gnolang/goleveldb - most popular implementation)
# - pure go
# - stable
# * cleveldb (uses levigo wrapper)
Expand Down
8 changes: 0 additions & 8 deletions tm2/pkg/crypto/keys/os_default.go

This file was deleted.

8 changes: 0 additions & 8 deletions tm2/pkg/crypto/keys/os_wasm.go

This file was deleted.

2 changes: 1 addition & 1 deletion tm2/pkg/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type BackendType string

// These are valid backend types.
const (
// GoLevelDBBackend represents goleveldb (github.com/syndtr/goleveldb - most
// GoLevelDBBackend represents goleveldb (github.com/gnolang/goleveldb - most
// popular implementation)
// - stable
GoLevelDBBackend BackendType = "goleveldb"
Expand Down
15 changes: 6 additions & 9 deletions tm2/pkg/db/go_level_db.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build !wasm && !js
// +build !wasm,!js

package db

import (
Expand All @@ -9,10 +6,10 @@ import (
"fmt"
"path/filepath"

"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/errors"
"github.com/syndtr/goleveldb/leveldb/iterator"
"github.com/syndtr/goleveldb/leveldb/opt"
"github.com/gnolang/goleveldb/leveldb"
"github.com/gnolang/goleveldb/leveldb/errors"
"github.com/gnolang/goleveldb/leveldb/iterator"
"github.com/gnolang/goleveldb/leveldb/opt"
)

func init() {
Expand Down Expand Up @@ -292,7 +289,7 @@ func (itr *goLevelDBIterator) Valid() bool {
// Implements Iterator.
func (itr *goLevelDBIterator) Key() []byte {
// Key returns a copy of the current key.
// See https://github.com/syndtr/goleveldb/blob/52c212e6c196a1404ea59592d3f1c227c9f034b2/leveldb/iterator/iter.go#L88
// See https://github.com/gnolang/goleveldb/blob/52c212e6c196a1404ea59592d3f1c227c9f034b2/leveldb/iterator/iter.go#L88
itr.assertNoError()
itr.assertIsValid()
return cp(itr.source.Key())
Expand All @@ -301,7 +298,7 @@ func (itr *goLevelDBIterator) Key() []byte {
// Implements Iterator.
func (itr *goLevelDBIterator) Value() []byte {
// Value returns a copy of the current value.
// See https://github.com/syndtr/goleveldb/blob/52c212e6c196a1404ea59592d3f1c227c9f034b2/leveldb/iterator/iter.go#L88
// See https://github.com/gnolang/goleveldb/blob/52c212e6c196a1404ea59592d3f1c227c9f034b2/leveldb/iterator/iter.go#L88
itr.assertNoError()
itr.assertIsValid()
return cp(itr.source.Value())
Expand Down
2 changes: 1 addition & 1 deletion tm2/pkg/db/go_level_db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/stretchr/testify/require"
"github.com/syndtr/goleveldb/leveldb/opt"
"github.com/gnolang/goleveldb/leveldb/opt"
)

func TestGoLevelDBNewGoLevelDB(t *testing.T) {
Expand Down

0 comments on commit 0482c08

Please sign in to comment.