Documentation
¶
Index ¶
- Constants
- type Database
- func (d *Database) Close() error
- func (d *Database) Compact(start []byte, end []byte) error
- func (d *Database) Delete(key []byte) error
- func (d *Database) Get(key []byte) ([]byte, error)
- func (d *Database) Has(key []byte) (bool, error)
- func (d *Database) HealthCheck(ctx context.Context) (interface{}, error)
- func (db *Database) NewBatch() database.Batch
- func (d *Database) NewIterator() database.Iterator
- func (d *Database) NewIteratorWithPrefix(prefix []byte) database.Iterator
- func (d *Database) NewIteratorWithStart(start []byte) database.Iterator
- func (d *Database) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator
- func (d *Database) Put(key []byte, value []byte) error
Constants ¶
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
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
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) Get ¶ added in v1.0.3
Get retrieves the given key if it's present in the key-value store.
func (*Database) HealthCheck ¶ added in v1.0.3
HealthCheck returns nil if the database is healthy, or an error otherwise.
func (*Database) NewIterator ¶ added in v1.0.3
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
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
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
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).