Browse Source

remove deprecated LevelDBBackend

pull/3628/head
Anton Kaliaev 6 years ago
parent
commit
1aa85453f7
No known key found for this signature in database GPG Key ID: 7B6881D965918214
6 changed files with 25 additions and 14 deletions
  1. +1
    -1
      config/config.go
  2. +0
    -1
      libs/db/c_level_db.go
  3. +2
    -2
      libs/db/c_level_db_test.go
  4. +21
    -8
      libs/db/db.go
  5. +0
    -1
      libs/db/go_level_db.go
  6. +1
    -1
      lite/proxy/verifier.go

+ 1
- 1
config/config.go View File

@ -218,7 +218,7 @@ func DefaultBaseConfig() BaseConfig {
ProfListenAddress: "",
FastSync: true,
FilterPeers: false,
DBBackend: "leveldb",
DBBackend: "goleveldb",
DBPath: "data",
}
}


+ 0
- 1
libs/db/c_level_db.go View File

@ -13,7 +13,6 @@ func init() {
dbCreator := func(name string, dir string) (DB, error) {
return NewCLevelDB(name, dir)
}
registerDBCreator(LevelDBBackend, dbCreator, true)
registerDBCreator(CLevelDBBackend, dbCreator, false)
}


+ 2
- 2
libs/db/c_level_db_test.go View File

@ -92,7 +92,7 @@ func TestCLevelDBBackend(t *testing.T) {
// 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 := NewDB(name, LevelDBBackend, dir)
db := NewDB(name, CLevelDBBackend, dir)
defer cleanupDBDir(dir, name)
_, ok := db.(*CLevelDB)
@ -102,7 +102,7 @@ func TestCLevelDBBackend(t *testing.T) {
func TestCLevelDBStats(t *testing.T) {
name := fmt.Sprintf("test_%x", cmn.RandStr(12))
dir := os.TempDir()
db := NewDB(name, LevelDBBackend, dir)
db := NewDB(name, CLevelDBBackend, dir)
defer cleanupDBDir(dir, name)
assert.NotEmpty(t, db.Stats())


+ 21
- 8
libs/db/db.go View File

@ -5,18 +5,31 @@ import (
"strings"
)
//----------------------------------------
// Main entry
type DBBackendType string
// These are valid db_backend values.
const (
LevelDBBackend DBBackendType = "leveldb" // legacy, defaults to goleveldb unless +gcc
CLevelDBBackend DBBackendType = "cleveldb"
// GoLevelDBBackend represents goleveldb (github.com/syndtr/goleveldb - most
// popular implementation)
// - pure go
// - stable
GoLevelDBBackend DBBackendType = "goleveldb"
MemDBBackend DBBackendType = "memdb"
FSDBBackend DBBackendType = "fsdb" // using the filesystem naively
BoltDBBackend DBBackendType = "boltdb"
// CLevelDBBackend represents cleveldb (uses levigo wrapper)
// - fast
// - requires gcc
CLevelDBBackend DBBackendType = "cleveldb"
// MemDBBackend represents in-memoty key value store, which is mostly used
// for testing.
MemDBBackend DBBackendType = "memdb"
// FSDBBackend represents filesystem database
// - EXPERIMENTAL
// - slow
FSDBBackend DBBackendType = "fsdb"
// BoltDBBackend represents bolt (uses etcd's fork of bolt -
// github.com/etcd-io/bbolt)
// - EXPERIMENTAL
// - may be faster is some use-cases (random reads - indexer)
BoltDBBackend DBBackendType = "boltdb"
)
type dbCreator func(name string, dir string) (DB, error)


+ 0
- 1
libs/db/go_level_db.go View File

@ -15,7 +15,6 @@ func init() {
dbCreator := func(name string, dir string) (DB, error) {
return NewGoLevelDB(name, dir)
}
registerDBCreator(LevelDBBackend, dbCreator, false)
registerDBCreator(GoLevelDBBackend, dbCreator, false)
}


+ 1
- 1
lite/proxy/verifier.go View File

@ -14,7 +14,7 @@ func NewVerifier(chainID, rootDir string, client lclient.SignStatusClient, logge
logger.Info("lite/proxy/NewVerifier()...", "chainID", chainID, "rootDir", rootDir, "client", client)
memProvider := lite.NewDBProvider("trusted.mem", dbm.NewMemDB()).SetLimit(cacheSize)
lvlProvider := lite.NewDBProvider("trusted.lvl", dbm.NewDB("trust-base", dbm.LevelDBBackend, rootDir))
lvlProvider := lite.NewDBProvider("trusted.lvl", dbm.NewDB("trust-base", dbm.GoLevelDBBackend, rootDir))
trust := lite.NewMultiProvider(
memProvider,
lvlProvider,


Loading…
Cancel
Save