Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pebbledb to docs #3061

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion database/pebble/batch.go → database/pebbledb/batch.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 2 additions & 2 deletions database/pebble/db.go → database/pebbledb/db.go
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
14 changes: 7 additions & 7 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -729,24 +729,24 @@ 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(
"db-type was %q but should have been one of {%s, %s, %s}",
n.Config.DatabaseConfig.Name,
leveldb.Name,
memdb.Name,
pebble.Name,
pebbledb.Name,
)
}

Expand Down
Loading