From c7bd0625adcd27f374a125886bb1df798746d42e Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Thu, 30 May 2024 11:53:27 -0400 Subject: [PATCH] Add pebbledb to docs --- config/config.md | 2 +- config/flags.go | 4 ++-- database/{pebble => pebbledb}/batch.go | 2 +- database/{pebble => pebbledb}/batch_test.go | 2 +- database/{pebble => pebbledb}/db.go | 4 ++-- database/{pebble => pebbledb}/db_test.go | 2 +- database/{pebble => pebbledb}/iterator.go | 2 +- node/node.go | 14 +++++++------- 8 files changed, 16 insertions(+), 16 deletions(-) rename database/{pebble => pebbledb}/batch.go (99%) rename database/{pebble => pebbledb}/batch_test.go (98%) rename database/{pebble => pebbledb}/db.go (99%) rename database/{pebble => pebbledb}/db_test.go (99%) rename database/{pebble => pebbledb}/iterator.go (99%) diff --git a/config/config.md b/config/config.md index e21c65aea195..8eb419024292 100644 --- a/config/config.md +++ b/config/config.md @@ -272,7 +272,7 @@ Specifies the directory to which the database is persisted. Defaults to `"$HOME/ ##### `--db-type` (string) -Specifies the type of database to use. Must be one of `LevelDB` or `memdb`. +Specifies the type of database to use. Must be one of `leveldb`, `memdb`, or `pebbledb`. `memdb` is an in-memory, non-persisted database. :::note diff --git a/config/flags.go b/config/flags.go index 3dae87125ee6..661eb9e84e66 100644 --- a/config/flags.go +++ b/config/flags.go @@ -15,7 +15,7 @@ import ( "github.com/ava-labs/avalanchego/database/leveldb" "github.com/ava-labs/avalanchego/database/memdb" - "github.com/ava-labs/avalanchego/database/pebble" + "github.com/ava-labs/avalanchego/database/pebbledb" "github.com/ava-labs/avalanchego/genesis" "github.com/ava-labs/avalanchego/snow/consensus/snowball" "github.com/ava-labs/avalanchego/trace" @@ -109,7 +109,7 @@ func addNodeFlags(fs *pflag.FlagSet) { fs.Uint64(AddSubnetDelegatorFeeKey, genesis.LocalParams.AddSubnetDelegatorFee, "Transaction fee, in nAVAX, for transactions that add new subnet delegators") // Database - fs.String(DBTypeKey, leveldb.Name, fmt.Sprintf("Database type to use. Must be one of {%s, %s, %s}", leveldb.Name, memdb.Name, pebble.Name)) + fs.String(DBTypeKey, leveldb.Name, fmt.Sprintf("Database type to use. Must be one of {%s, %s, %s}", leveldb.Name, memdb.Name, pebbledb.Name)) fs.Bool(DBReadOnlyKey, false, "If true, database writes are to memory and never persisted. May still initialize database directory/files on disk if they don't exist") fs.String(DBPathKey, defaultDBDir, "Path to database directory") fs.String(DBConfigFileKey, "", fmt.Sprintf("Path to database config file. Ignored if %s is specified", DBConfigContentKey)) diff --git a/database/pebble/batch.go b/database/pebbledb/batch.go similarity index 99% rename from database/pebble/batch.go rename to database/pebbledb/batch.go index 8778a9473960..a14666749bc9 100644 --- a/database/pebble/batch.go +++ b/database/pebbledb/batch.go @@ -1,7 +1,7 @@ // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -package pebble +package pebbledb import ( "fmt" diff --git a/database/pebble/batch_test.go b/database/pebbledb/batch_test.go similarity index 98% rename from database/pebble/batch_test.go rename to database/pebbledb/batch_test.go index 4fcc537d1e84..3a0ad63b7e43 100644 --- a/database/pebble/batch_test.go +++ b/database/pebbledb/batch_test.go @@ -1,7 +1,7 @@ // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -package pebble +package pebbledb import ( "testing" diff --git a/database/pebble/db.go b/database/pebbledb/db.go similarity index 99% rename from database/pebble/db.go rename to database/pebbledb/db.go index 0acb10d12c5c..ca048ec5f636 100644 --- a/database/pebble/db.go +++ b/database/pebbledb/db.go @@ -1,7 +1,7 @@ // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -package pebble +package pebbledb import ( "context" @@ -21,7 +21,7 @@ import ( ) const ( - Name = "pebble" + Name = "pebbledb" // pebbleByteOverHead is the number of bytes of constant overhead that // should be added to a batch size per operation. diff --git a/database/pebble/db_test.go b/database/pebbledb/db_test.go similarity index 99% rename from database/pebble/db_test.go rename to database/pebbledb/db_test.go index 3b37d9362d92..506221dce5cd 100644 --- a/database/pebble/db_test.go +++ b/database/pebbledb/db_test.go @@ -1,7 +1,7 @@ // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -package pebble +package pebbledb import ( "fmt" diff --git a/database/pebble/iterator.go b/database/pebbledb/iterator.go similarity index 99% rename from database/pebble/iterator.go rename to database/pebbledb/iterator.go index 40654dc41d98..5e9786a318c8 100644 --- a/database/pebble/iterator.go +++ b/database/pebbledb/iterator.go @@ -1,7 +1,7 @@ // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -package pebble +package pebbledb import ( "errors" diff --git a/node/node.go b/node/node.go index 3138f00c1c38..2103762f658a 100644 --- a/node/node.go +++ b/node/node.go @@ -36,7 +36,7 @@ import ( "github.com/ava-labs/avalanchego/database/leveldb" "github.com/ava-labs/avalanchego/database/memdb" "github.com/ava-labs/avalanchego/database/meterdb" - "github.com/ava-labs/avalanchego/database/pebble" + "github.com/ava-labs/avalanchego/database/pebbledb" "github.com/ava-labs/avalanchego/database/prefixdb" "github.com/ava-labs/avalanchego/database/versiondb" "github.com/ava-labs/avalanchego/genesis" @@ -729,16 +729,16 @@ func (n *Node) initDatabase() error { var err error n.DB, err = leveldb.New(dbPath, n.Config.DatabaseConfig.Config, n.Log, "db_internal", n.MetricsRegisterer) if err != nil { - return fmt.Errorf("couldn't create leveldb at %s: %w", dbPath, err) + return fmt.Errorf("couldn't create %s at %s: %w", leveldb.Name, dbPath, err) } case memdb.Name: n.DB = memdb.New() - case pebble.Name: - dbPath := filepath.Join(n.Config.DatabaseConfig.Path, pebble.Name) + case pebbledb.Name: + dbPath := filepath.Join(n.Config.DatabaseConfig.Path, "pebble") var err error - n.DB, err = pebble.New(dbPath, n.Config.DatabaseConfig.Config, n.Log, "db_internal", n.MetricsRegisterer) + n.DB, err = pebbledb.New(dbPath, n.Config.DatabaseConfig.Config, n.Log, "db_internal", n.MetricsRegisterer) if err != nil { - return fmt.Errorf("couldn't create pebbledb at %s: %w", dbPath, err) + return fmt.Errorf("couldn't create %s at %s: %w", pebbledb.Name, dbPath, err) } default: return fmt.Errorf( @@ -746,7 +746,7 @@ func (n *Node) initDatabase() error { n.Config.DatabaseConfig.Name, leveldb.Name, memdb.Name, - pebble.Name, + pebbledb.Name, ) }