Documentation ¶
Index ¶
- type LevelDB
- func (ldb *LevelDB) Close() error
- func (ldb *LevelDB) Compact(start []byte, limit []byte) error
- func (ldb *LevelDB) Delete(key []byte) error
- func (ldb *LevelDB) Get(key []byte) (value []byte, err error)
- func (ldb *LevelDB) Has(key []byte) (bool, error)
- func (ldb *LevelDB) IsNotFound(err error) bool
- func (ldb *LevelDB) NewBatch() kv.Batch
- func (ldb *LevelDB) NewIterator(r kv.Range) kv.Iterator
- func (ldb *LevelDB) Put(key, value []byte) error
- func (ldb *LevelDB) Stat(property string) (string, error)
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LevelDB ¶
type LevelDB struct {
// contains filtered or unexported fields
}
LevelDB wraps level db impls.
func New ¶
New create a persistent level db instance. Create an empty one if not exists, or open if already there.
func (*LevelDB) Compact ¶
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 (*LevelDB) Get ¶
Get retrieve value for given key. It returns an error if key not found. The error can be checked via IsNotFound.
func (*LevelDB) IsNotFound ¶
IsNotFound to check if the error returned by Get indicates key not found.
func (*LevelDB) NewIterator ¶
NewIterator create a iterator by range.