Documentation ¶
Index ¶
- Constants
- func New(file string, configBytes []byte, log logging.Logger, namespace string, ...) (database.Database, error)
- type Database
- func (db *Database) Close() error
- func (db *Database) Compact(start []byte, limit []byte) error
- func (db *Database) Delete(key []byte) error
- func (db *Database) Get(key []byte) ([]byte, error)
- func (db *Database) Has(key []byte) (bool, error)
- func (db *Database) HealthCheck(context.Context) (interface{}, error)
- func (db *Database) NewBatch() database.Batch
- func (db *Database) NewIterator() database.Iterator
- func (db *Database) NewIteratorWithPrefix(prefix []byte) database.Iterator
- func (db *Database) NewIteratorWithStart(start []byte) database.Iterator
- func (db *Database) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator
- func (db *Database) Put(key []byte, value []byte) error
Constants ¶
const ( // Name is the name of this database for database switches Name = "leveldb" // DefaultBlockCacheSize is the number of bytes to use for block caching in // leveldb. DefaultBlockCacheSize = 12 * opt.MiB // DefaultWriteBufferSize is the number of bytes to use for buffers in // leveldb. DefaultWriteBufferSize = 12 * opt.MiB // DefaultHandleCap is the number of files descriptors to cap levelDB to // use. DefaultHandleCap = 1024 // DefaultBitsPerKey is the number of bits to add to the bloom filter per // key. DefaultBitsPerKey = 10 // DefaultMaxManifestFileSize is the default maximum size of a manifest // file. // // This avoids https://github.com/syndtr/goleveldb/issues/413. DefaultMaxManifestFileSize = math.MaxInt64 // DefaultMetricUpdateFrequency is the frequency to poll the LevelDB // metrics. DefaultMetricUpdateFrequency = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Database ¶
Database is a persistent key-value store. Apart from basic data storage functionality it also supports batch writes and iterating over the keyspace in binary-alphabetical order.
func (*Database) Compact ¶
Compact the underlying DB for the given key range. Specifically, deleted and overwritten versions are discarded, and the data is rearranged to reduce the cost of operations needed to access the data. This operation should typically only be invoked by users who understand the underlying implementation.
A nil start is treated as a key before all keys in the DB. And a nil limit is treated as a key after all keys in the DB. Therefore if both are nil then it will compact entire DB.
func (*Database) HealthCheck ¶ added in v1.8.4
func (*Database) NewBatch ¶
NewBatch creates a write/delete-only buffer that is atomically committed to the database when write is called
func (*Database) NewIterator ¶
NewIterator creates a lexicographically ordered iterator over the database
func (*Database) NewIteratorWithPrefix ¶
NewIteratorWithPrefix creates a lexicographically ordered iterator over the database ignoring keys that do not start with the provided prefix
func (*Database) NewIteratorWithStart ¶
NewIteratorWithStart creates a lexicographically ordered iterator over the database starting at the provided key
func (*Database) NewIteratorWithStartAndPrefix ¶
NewIteratorWithStartAndPrefix creates a lexicographically ordered iterator over the database starting at start and ignoring keys that do not start with the provided prefix