Documentation ¶
Overview ¶
Package kv provides key-value based storage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch interface { Writer // Reset clear pending operations. Reset() // Write flush pending operations. // It will not clear pending operations. Write() error // Len returns pending operations count. Len() int }
Batch interface of batched operation.
type Iterator ¶
type Iterator interface { First() bool Last() bool Seek(key []byte) bool Next() bool Prev() bool Release() Error() error Key() []byte Value() []byte }
Iterator see iterator in leveldb.
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
Range describes key range of kv store.
func NewRangeWithBytesPrefix ¶
NewRangeWithBytesPrefix create a range defined by bytes prefix.
func NewRangeWithHexPrefix ¶
NewRangeWithHexPrefix create a range defined by hex prefix. The hex can be odd.
type Reader ¶
type Reader interface { // Has returns whether a key exists Has(key []byte) (bool, error) // Get retrieve value for the given key. Get(key []byte) (*OptValue, error) }
Reader kv reading methods
type Store ¶
type Store interface { Reader Writer // NewBatch create batch object for batch writes. NewBatch() Batch // NewIterator create iterator to iterates kv pairs for the given range. NewIterator(r *Range) Iterator // Close close the store. Close() error }
Store interface of key-value storage.
func NewMemStore ¶
NewMemStore create kv store in memory, for test purpose
Click to show internal directories.
Click to hide internal directories.