leveldb

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OpenFileLimit = 64

Functions

This section is empty.

Types

type LDBDatabase

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

func New

func New(file string, cache int, handles int, namespace string, readonly bool) (*LDBDatabase, error)

New returns a wrapped LevelDB object. The namespace is the prefix that the metrics reporting should use for surfacing internal stats.

func NewCustom

func NewCustom(file string, namespace string, customize func(options *opt.Options)) (*LDBDatabase, error)

NewCustom returns a wrapped LevelDB object. The namespace is the prefix that the metrics reporting should use for surfacing internal stats. The customize function allows the caller to modify the leveldb options.

func NewLDBDatabase

func NewLDBDatabase(file string, cache int, handles int) (*LDBDatabase, error)

NewLDBDatabase returns a LevelDB wrapped object.

func (*LDBDatabase) Close

func (db *LDBDatabase) Close() error

func (*LDBDatabase) Compact

func (db *LDBDatabase) Compact(start []byte, limit []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 is nil then it will compact entire data store.

func (*LDBDatabase) Delete

func (db *LDBDatabase) Delete(key []byte) error

Delete deletes the key from the queue and database

func (*LDBDatabase) Get

func (db *LDBDatabase) Get(key []byte) ([]byte, error)

Get returns the given key if it's present.

func (*LDBDatabase) Has

func (db *LDBDatabase) Has(key []byte) (bool, error)

func (*LDBDatabase) LDB

func (db *LDBDatabase) LDB() *leveldb.DB

func (*LDBDatabase) Meter

func (db *LDBDatabase) Meter(prefix string)

Meter configures the database metrics collectors and

func (*LDBDatabase) NewBatch

func (db *LDBDatabase) NewBatch() ethdb.Batch

func (*LDBDatabase) NewBatchWithSize

func (db *LDBDatabase) NewBatchWithSize(size int) ethdb.Batch

func (*LDBDatabase) NewIterator

func (db *LDBDatabase) NewIterator(prefix []byte, start []byte) ethdb.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 (*LDBDatabase) NewIteratorWithPrefix

func (db *LDBDatabase) NewIteratorWithPrefix(prefix []byte) iterator.Iterator

NewIteratorWithPrefix returns a iterator to iterate over subset of database content with a particular prefix.

func (*LDBDatabase) NewSnapshot

func (db *LDBDatabase) NewSnapshot() (ethdb.Snapshot, error)

NewSnapshot creates a database snapshot based on the current state. The created snapshot will not be affected by all following mutations happened on the database. Note don't forget to release the snapshot once it's used up, otherwise the stale data will never be cleaned up by the underlying compactor.

func (*LDBDatabase) Path

func (db *LDBDatabase) Path() string

Path returns the path to the database directory.

func (*LDBDatabase) Put

func (db *LDBDatabase) Put(key []byte, value []byte) error

Put puts the given key / value to the queue

func (*LDBDatabase) Stat

func (db *LDBDatabase) Stat(property string) (string, error)

Stat returns a particular internal stat of the database.

func (*LDBDatabase) Sync

func (db *LDBDatabase) Sync() error

Jump to

Keyboard shortcuts

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