Documentation ¶
Index ¶
- Constants
- Variables
- func KVPrefixNext(key []byte) []byte
- func MarshalHashObj(obj *HashObj) []byte
- func MarshalListObj(obj *ListObj) []byte
- func MarshalSetObj(obj *SetObj) []byte
- func MarshalZSetObj(obj *ZSetObj) []byte
- func RawKeyPrefix(key []byte) []byte
- type BoltCfg
- type DataEngine
- type Driver
- type Engine
- type HashEngine
- type HashObj
- type KVEngine
- type ListEngine
- type ListObj
- type MemberPair
- type NemoCfg
- type RangeDeleteable
- type Scanable
- type Seekable
- type SetEngine
- type SetObj
- type WriteBatch
- type ZSetEngine
- type ZSetObj
Constants ¶
Variables ¶
View Source
var ( // ErrKeySize key size is 0 ErrKeySize = errors.New("invalid key size") // ErrValueSize value size is 0 ErrValueSize = errors.New("invalid value size") // ErrEmptyKey key size is 0 ErrEmptyKey = errors.New("invalid key size") //ErrListIndex index not in list range[head, tail] ErrListIndex = errors.New("invalid index of list") //ErrKeyOrFieldEmpty length of key or field is zero ErrKeyOrFieldEmpty = errors.New("invalid key or field") ErrInvalidMeta = errors.New("ERR invalid key meta") )
Functions ¶
func KVPrefixNext ¶
KVPrefixNext use Greedy algorithm, calculate next KVPrefix
func MarshalHashObj ¶
func MarshalListObj ¶
MarshalListObj Serialize ListObj func
func MarshalSetObj ¶
func MarshalZSetObj ¶
func RawKeyPrefix ¶
Types ¶
type DataEngine ¶
type DataEngine interface { RangeDeleteable // GetTargetSizeKey Find a key in the range [startKey, endKey) that sum size over target // if found returns the key GetTargetSizeKey(startKey []byte, endKey []byte, size uint64) (uint64, []byte, error) // CreateSnapshot create a snapshot file under the giving path CreateSnapshot(path string, start, end []byte) error // ApplySnapshot apply a snapshort file from giving path ApplySnapshot(path string) error // ScanIndexInfo scans the range and execute the handler fun. Returens a tuple (error count, first error) ScanIndexInfo(startKey []byte, endKey []byte, skipEmpty bool, handler func(key, idxInfo []byte) error) (int, error) SetIndexInfo(key, idxInfo []byte) error GetIndexInfo(key []byte) (idxInfo []byte, err error) }
DataEngine is the storage of redis data
type Driver ¶
type Driver interface { GetEngine() Engine GetDataEngine() DataEngine GetKVEngine() KVEngine GetHashEngine() HashEngine GetSetEngine() SetEngine GetZSetEngine() ZSetEngine GetListEngine() ListEngine NewWriteBatch() WriteBatch Write(wb WriteBatch, sync bool) error }
Driver is def storage interface
func NewBoltDriver ¶
func NewMemoryDriver ¶
func NewMemoryDriver() Driver
NewMemoryDriver returns Driver with memory implemention
func NewNemoDriver ¶
NewNemoDriver return a driver implemention by nemo
type Engine ¶
type Engine interface { Scanable Seekable RangeDeleteable Set(key []byte, value []byte) error Get(key []byte) ([]byte, error) Delete(key []byte) error }
Engine is the storage of meta data
type HashEngine ¶
type HashEngine interface { HSet(key, field, value []byte) (int64, error) HGet(key, field []byte) ([]byte, error) HDel(key []byte, fields ...[]byte) (int64, error) HExists(key, field []byte) (bool, error) HKeys(key []byte) ([][]byte, error) HVals(key []byte) ([][]byte, error) HGetAll(key []byte) ([]*raftcmdpb.FVPair, error) HScanGet(key, start []byte, count int) ([]*raftcmdpb.FVPair, error) HLen(key []byte) (int64, error) HMGet(key []byte, fields ...[]byte) ([][]byte, []error) HMSet(key []byte, fields, values [][]byte) error HSetNX(key, field, value []byte) (int64, error) HStrLen(key, field []byte) (int64, error) HIncrBy(key, field []byte, incrment int64) ([]byte, error) }
HashEngine is the storage of Hash
type KVEngine ¶
type KVEngine interface { RangeDeleteable Set(key, value []byte) error MSet(keys [][]byte, values [][]byte) error Get(key []byte) ([]byte, error) IncrBy(key []byte, incrment int64) (int64, error) DecrBy(key []byte, incrment int64) (int64, error) GetSet(key, value []byte) ([]byte, error) Append(key, value []byte) (int64, error) SetNX(key, value []byte) (int64, error) StrLen(key []byte) (int64, error) NewWriteBatch() WriteBatch Write(wb WriteBatch) error }
KVEngine is the storage of KV
type ListEngine ¶
type ListEngine interface { LIndex(key []byte, index int64) ([]byte, error) LInsert(key []byte, pos int, pivot []byte, value []byte) (int64, error) LLen(key []byte) (int64, error) LPop(key []byte) ([]byte, error) LPush(key []byte, values ...[]byte) (int64, error) LPushX(key []byte, value []byte) (int64, error) LRange(key []byte, begin int64, end int64) ([][]byte, error) LRem(key []byte, count int64, value []byte) (int64, error) LSet(key []byte, index int64, value []byte) error LTrim(key []byte, begin int64, end int64) error RPop(key []byte) ([]byte, error) RPush(key []byte, values ...[]byte) (int64, error) RPushX(key []byte, value []byte) (int64, error) }
ListEngine is the storage of List
type ListObj ¶
func UnmarshalListObj ¶
UnmarshalListObj Deserialize ListObj func
type MemberPair ¶
type RangeDeleteable ¶
RangeDeleteable support range delete
type Scanable ¶
type Scanable interface { // Scan scans the range and execute the handler fun. // returns false means end the scan. Scan(start, end []byte, handler func(key, value []byte) (bool, error), pooledKey bool) error // Free free the pooled bytes Free(pooled []byte) }
Scanable support scan
type SetEngine ¶
type SetEngine interface { SAdd(key []byte, members ...[]byte) (int64, error) SRem(key []byte, members ...[]byte) (int64, error) SCard(key []byte) (int64, error) SMembers(key []byte) ([][]byte, error) SIsMember(key []byte, member []byte) (int64, error) SPop(key []byte) ([]byte, error) }
SetEngine is the storage of Set
type WriteBatch ¶
WriteBatch batch operation
type ZSetEngine ¶
type ZSetEngine interface { ZAdd(key []byte, score float64, member []byte) (int64, error) ZCard(key []byte) (int64, error) ZCount(key []byte, min []byte, max []byte) (int64, error) ZIncrBy(key []byte, member []byte, by float64) ([]byte, error) ZLexCount(key []byte, min []byte, max []byte) (int64, error) ZRange(key []byte, start int64, stop int64) ([]*raftcmdpb.ScorePair, error) ZRangeByLex(key []byte, min []byte, max []byte) ([][]byte, error) ZRangeByScore(key []byte, min []byte, max []byte) ([]*raftcmdpb.ScorePair, error) ZRank(key []byte, member []byte) (int64, error) ZRem(key []byte, members ...[]byte) (int64, error) ZRemRangeByLex(key []byte, min []byte, max []byte) (int64, error) ZRemRangeByRank(key []byte, start int64, stop int64) (int64, error) ZRemRangeByScore(key []byte, min []byte, max []byte) (int64, error) ZScore(key []byte, member []byte) ([]byte, error) }
ZSetEngine is the storage of ZSet
Source Files ¶
- bolt_data_structure.go
- bolt_engine.go
- bolt_engine_data.go
- bolt_engine_hash.go
- bolt_engine_kv.go
- bolt_engine_list.go
- bolt_engine_meta.go
- bolt_engine_set.go
- bolt_engine_zset.go
- driver.go
- errors.go
- memory_driver.go
- memory_engine_data.go
- memory_engine_kv.go
- memory_engine_meta.go
- nemo_driver.go
- nemo_engine_data.go
- nemo_engine_hash.go
- nemo_engine_kv.go
- nemo_engine_list.go
- nemo_engine_meta.go
- nemo_engine_set.go
- nemo_engine_zset.go
- nemo_writebatch.go
Click to show internal directories.
Click to hide internal directories.