Documentation ¶
Index ¶
- type ByteSliceValue
- type MemoryKV
- func (kv *MemoryKV) Close()
- func (kv *MemoryKV) Get(key string) string
- func (kv *MemoryKV) Has(key string) (bool, error)
- func (kv *MemoryKV) HasPrefix(prefix string) (bool, error)
- func (kv *MemoryKV) Load(key string) (string, error)
- func (kv *MemoryKV) LoadBytes(key string) ([]byte, error)
- func (kv *MemoryKV) LoadBytesRange(key, endKey string, limit int) ([]string, [][]byte, error)
- func (kv *MemoryKV) LoadBytesWithDefault(key string, defaultValue []byte) []byte
- func (kv *MemoryKV) LoadBytesWithPrefix(key string) ([]string, [][]byte, error)
- func (kv *MemoryKV) LoadWithPrefix(key string) ([]string, []string, error)
- func (kv *MemoryKV) MultiLoad(keys []string) ([]string, error)
- func (kv *MemoryKV) MultiLoadBytes(keys []string) ([][]byte, error)
- func (kv *MemoryKV) MultiRemove(keys []string) error
- func (kv *MemoryKV) MultiSave(kvs map[string]string) error
- func (kv *MemoryKV) MultiSaveAndRemove(saves map[string]string, removals []string, preds ...predicates.Predicate) error
- func (kv *MemoryKV) MultiSaveAndRemoveWithPrefix(saves map[string]string, removals []string, preds ...predicates.Predicate) error
- func (kv *MemoryKV) MultiSaveBytes(kvs map[string][]byte) error
- func (kv *MemoryKV) MultiSaveBytesAndRemove(saves map[string][]byte, removals []string) error
- func (kv *MemoryKV) MultiSaveBytesAndRemoveWithPrefix(saves map[string][]byte, removals []string) error
- func (kv *MemoryKV) Remove(key string) error
- func (kv *MemoryKV) RemoveWithPrefix(key string) error
- func (kv *MemoryKV) Save(key, value string) error
- func (kv *MemoryKV) SaveBytes(key string, value []byte) error
- type StringValue
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByteSliceValue ¶
type ByteSliceValue []byte
func (ByteSliceValue) ByteSlice ¶
func (v ByteSliceValue) ByteSlice() []byte
func (ByteSliceValue) String ¶
func (v ByteSliceValue) String() string
type MemoryKV ¶
MemoryKV implements BaseKv interface and relies on underling btree.BTree. As its name implies, all data is stored in memory.
func NewMemoryKV ¶
func NewMemoryKV() *MemoryKV
NewMemoryKV returns an in-memory kvBase for testing.
func (*MemoryKV) LoadBytesRange ¶
LoadBytesRange loads objects with range @startKey to @endKey with @limit number of objects.
func (*MemoryKV) LoadBytesWithDefault ¶
LoadBytesWithDefault loads an object with @key. If the object does not exist, @defaultValue will be returned.
func (*MemoryKV) LoadBytesWithPrefix ¶
LoadBytesWithPrefix returns all keys & values with given prefix.
func (*MemoryKV) LoadWithPrefix ¶
LoadWithPrefix returns all keys & values with given prefix.
func (*MemoryKV) MultiLoadBytes ¶
MultiLoadBytes loads objects with multi @keys.
func (*MemoryKV) MultiRemove ¶
MultiRemove removes given @keys in MemoryKV atomicly.
func (*MemoryKV) MultiSaveAndRemove ¶
func (kv *MemoryKV) MultiSaveAndRemove(saves map[string]string, removals []string, preds ...predicates.Predicate) error
MultiSaveAndRemove saves and removes given key-value pairs in MemoryKV atomicly.
func (*MemoryKV) MultiSaveAndRemoveWithPrefix ¶
func (kv *MemoryKV) MultiSaveAndRemoveWithPrefix(saves map[string]string, removals []string, preds ...predicates.Predicate) error
MultiSaveAndRemoveWithPrefix saves key-value pairs in @saves, & remove key with prefix in @removals in MemoryKV atomically.
func (*MemoryKV) MultiSaveBytes ¶
MultiSaveBytes saves given key-value pairs in MemoryKV atomicly.
func (*MemoryKV) MultiSaveBytesAndRemove ¶
MultiSaveBytesAndRemove saves and removes given key-value pairs in MemoryKV atomicly.
func (*MemoryKV) MultiSaveBytesAndRemoveWithPrefix ¶
func (kv *MemoryKV) MultiSaveBytesAndRemoveWithPrefix(saves map[string][]byte, removals []string) error
MultiSaveBytesAndRemoveWithPrefix saves key-value pairs in @saves, & remove key with prefix in @removals in MemoryKV atomically.
func (*MemoryKV) RemoveWithPrefix ¶
RemoveWithPrefix remove key of given prefix in MemoryKV atomicly.
type StringValue ¶
type StringValue string
func (StringValue) ByteSlice ¶
func (v StringValue) ByteSlice() []byte
func (StringValue) String ¶
func (v StringValue) String() string