pebbledb

package
v1.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2025 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "pebbledb"

Variables

This section is empty.

Functions

This section is empty.

Types

type Database added in v1.0.3

type Database struct {
	// contains filtered or unexported fields
}

Database is a persistent key-value store implementing the Database interface. Apart from basic data storage functionality it also supports batch writes and iterating over the keyspace in binary-alphabetical order.

func New

func New(path string, cacheSize int, handles int, namespace string, readonly bool) (*Database, error)

New returns a new PebbleDB database.

func (*Database) Close added in v1.0.3

func (d *Database) Close() error

Close stops the metrics collection, flushes any pending data to disk and closes all io accesses to the underlying key-value store.

func (*Database) Compact added in v1.0.3

func (d *Database) Compact(start []byte, end []byte) error

Compact flattens the underlying data store for the given key range. In essence, deleted and overwritten versions are discarded, and the data is rearranged to reduce the cost of operations needed to access them.

A nil start is treated as a key before all keys in the data store; a nil limit is treated as a key after all keys in the data store. If both are nil then it will compact entire data store.

func (*Database) Delete added in v1.0.3

func (d *Database) Delete(key []byte) error

Delete removes the key from the key-value store.

func (*Database) Get added in v1.0.3

func (d *Database) Get(key []byte) ([]byte, error)

Get retrieves the given key if it's present in the key-value store.

func (*Database) Has added in v1.0.3

func (d *Database) Has(key []byte) (bool, error)

Has retrieves if a key is present in the key-value store.

func (*Database) HealthCheck added in v1.0.3

func (d *Database) HealthCheck(ctx context.Context) (interface{}, error)

HealthCheck returns nil if the database is healthy, or an error otherwise.

func (*Database) NewBatch added in v1.0.3

func (db *Database) NewBatch() database.Batch

func (*Database) NewIterator added in v1.0.3

func (d *Database) NewIterator() database.Iterator

NewIterator creates a binary-alphabetical iterator over a subset of database content with a particular key prefix, starting at a particular initial key (or after, if it does not exist).

func (*Database) NewIteratorWithPrefix added in v1.0.3

func (d *Database) NewIteratorWithPrefix(prefix []byte) database.Iterator

NewIteratorWithPrefix creates a binary-alphabetical iterator over a subset of database content with a particular key prefix.

func (*Database) NewIteratorWithStart added in v1.0.3

func (d *Database) NewIteratorWithStart(start []byte) database.Iterator

NewIteratorWithStart creates a binary-alphabetical iterator over a subset of database content starting at a particular initial key (or after, if it does not exist).

func (*Database) NewIteratorWithStartAndPrefix added in v1.0.3

func (d *Database) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator

NewIteratorWithStartAndPrefix creates a binary-alphabetical iterator over a subset of database content with a particular key prefix, starting at a particular initial key (or after, if it does not exist).

func (*Database) Put added in v1.0.3

func (d *Database) Put(key []byte, value []byte) error

Put inserts the given value into the key-value store.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL