Documentation ¶
Index ¶
- type Fallible
- func (f *Fallible) Close() error
- func (f *Fallible) Compact(start []byte, limit []byte) error
- func (f *Fallible) Delete(key []byte) error
- func (f *Fallible) Drop()
- func (f *Fallible) Get(key []byte) ([]byte, error)
- func (f *Fallible) GetSnapshot() (kvdb.Snapshot, error)
- func (f *Fallible) GetWriteCount() int
- func (f *Fallible) Has(key []byte) (bool, error)
- func (f *Fallible) NewBatch() kvdb.Batch
- func (f *Fallible) NewIterator(prefix []byte, start []byte) kvdb.Iterator
- func (f *Fallible) Put(key []byte, value []byte) error
- func (f *Fallible) SetWriteCount(n int)
- func (f *Fallible) Stat(property string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fallible ¶
type Fallible struct { Underlying kvdb.DropableStore // contains filtered or unexported fields }
Fallible is a kvdb.Store wrapper around any kvdb.Store. It falls when write counter is full for test purpose.
func Wrap ¶
func Wrap(db kvdb.DropableStore) *Fallible
Wrap returns a wrapped kvdb.Store with counter 0. Set it manually.
func (*Fallible) 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 (*Fallible) GetSnapshot ¶
GetSnapshot returns a latest snapshot of the underlying DB. A snapshot is a frozen snapshot of a DB state at a particular point in time. The content of snapshot are guaranteed to be consistent.
The snapshot must be released after use, by calling Release method.
func (*Fallible) NewBatch ¶
NewBatch creates a write-only database that buffers changes to its host db until a final write is called.
func (*Fallible) NewIterator ¶
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).