Documentation ¶
Index ¶
- Constants
- func DefaultPredicate(last []byte) func(key []byte) bool
- func NewLevelDBConfig() interface{}
- func NewMDBConfiguration() interface{}
- type Engine
- type Initializer
- type Iterator
- type LevelDB
- func (db LevelDB) BatchPut(writes []Write) error
- func (db LevelDB) Close()
- func (db LevelDB) Compact()
- func (db LevelDB) Del(start, finish []byte) error
- func (db LevelDB) Get(key []byte) ([]byte, error)
- func (db LevelDB) Iterator() Iterator
- func (_ LevelDB) Name() string
- func (db LevelDB) Path() string
- func (db LevelDB) Put(key, value []byte) error
- type LevelDbConfiguration
- type LevelDbIterator
- func (itr *LevelDbIterator) Close() error
- func (itr *LevelDbIterator) Error() error
- func (itr *LevelDbIterator) Key() []byte
- func (itr *LevelDbIterator) Next()
- func (itr *LevelDbIterator) Prev()
- func (itr *LevelDbIterator) Seek(key []byte)
- func (itr *LevelDbIterator) Valid() bool
- func (itr *LevelDbIterator) Value() []byte
- type MDB
- func (db MDB) BatchPut(writes []Write) error
- func (db MDB) Close()
- func (db MDB) Compact()
- func (db MDB) Del(start, finish []byte) error
- func (db MDB) Get(key []byte) ([]byte, error)
- func (db MDB) Iterator() Iterator
- func (_ MDB) Name() string
- func (db MDB) Path() string
- func (db MDB) Put(key, value []byte) error
- type MDBConfiguration
- type MDBIterator
- type Write
Constants ¶
View Source
const LEVELDB_NAME = "leveldb"
View Source
const MDB_NAME = "lmdb"
Variables ¶
This section is empty.
Functions ¶
func DefaultPredicate ¶
func NewLevelDBConfig ¶
func NewLevelDBConfig() interface{}
func NewMDBConfiguration ¶
func NewMDBConfiguration() interface{}
Types ¶
type Engine ¶
type Engine interface { Name() string Path() string // Add the given key/value pair, duplicates aren't allowed Put(key, value []byte) error // Get the value associated with the given key Get(key []byte) ([]byte, error) // More efficient put BatchPut(writes []Write) error // Delete the given range of keys [first, last] Del(first, last []byte) error // Get an iterator for the db Iterator() Iterator // Compact the db and reclaim unused space Compact() // Close the database Close() }
Interface to all storage engine backends
func NewLevelDB ¶
type Initializer ¶
type Initializer struct { NewConfig func() interface{} Initialize func(path string, config interface{}) (Engine, error) }
func GetInitializer ¶
func GetInitializer(name string) (Initializer, error)
type Iterator ¶
type Iterator interface { // Seek to the given key, or a larger key if this one doesn't exist Seek(key []byte) // Get the key at the current position Key() []byte // Get the value at the current position Value() []byte // Move the next element Next() // Move the previous element Prev() // True if no error occured during scanning and if the predicate // used when calling GetRangePredicate is true . If GetRange is // used, returns GetKey() <= last where <= is the lexicographic // order. Valid() bool // Returns any errors occured during scannig Error() error // Close the iterator and free the resources used Close() error }
Iterator is used to scan a range of keys
type LevelDbConfiguration ¶
type LevelDbConfiguration struct { MaxOpenFiles int `toml:"max-open-files"` LruCacheSize configuration.Size `toml:"lru-cache-size"` }
type LevelDbIterator ¶
type LevelDbIterator struct {
// contains filtered or unexported fields
}
func (*LevelDbIterator) Close ¶
func (itr *LevelDbIterator) Close() error
func (*LevelDbIterator) Error ¶
func (itr *LevelDbIterator) Error() error
func (*LevelDbIterator) Key ¶
func (itr *LevelDbIterator) Key() []byte
func (*LevelDbIterator) Next ¶
func (itr *LevelDbIterator) Next()
func (*LevelDbIterator) Prev ¶
func (itr *LevelDbIterator) Prev()
func (*LevelDbIterator) Seek ¶
func (itr *LevelDbIterator) Seek(key []byte)
func (*LevelDbIterator) Valid ¶
func (itr *LevelDbIterator) Valid() bool
func (*LevelDbIterator) Value ¶
func (itr *LevelDbIterator) Value() []byte
type MDBConfiguration ¶
type MDBConfiguration struct {
MapSize configuration.Size `toml:"map-size"`
}
type MDBIterator ¶
type MDBIterator struct {
// contains filtered or unexported fields
}
func (*MDBIterator) Close ¶
func (itr *MDBIterator) Close() error
func (*MDBIterator) Error ¶
func (itr *MDBIterator) Error() error
func (*MDBIterator) Key ¶
func (itr *MDBIterator) Key() []byte
func (*MDBIterator) Next ¶
func (itr *MDBIterator) Next()
func (*MDBIterator) Prev ¶
func (itr *MDBIterator) Prev()
func (*MDBIterator) Seek ¶
func (itr *MDBIterator) Seek(key []byte)
func (*MDBIterator) Valid ¶
func (itr *MDBIterator) Valid() bool
func (*MDBIterator) Value ¶
func (itr *MDBIterator) Value() []byte
Click to show internal directories.
Click to hide internal directories.