Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeMetaKey(p []byte) (db uint32, key []byte, err error)
- func EncodeDataKeyPrefix(db uint32, key []byte) []byte
- func EncodeMetaKey(db uint32, key []byte) []byte
- func EncodeMetaKeyPrefixSlot(db uint32, slot uint32) []byte
- func EncodeMetaKeyPrefixTag(db uint32, tag []byte) []byte
- func ExpireAtToTTLms(expireat int64) (int64, bool)
- func FormatByte(arg interface{}) []byte
- func FormatBytes(args ...interface{}) [][]byte
- func FormatFloat(v float64) []byte
- func FormatFloatString(v float64) string
- func FormatInt(v int64) []byte
- func FormatString(i interface{}) string
- func FormatUint(u uint64) []byte
- func HashKeyToSlot(key []byte) ([]byte, uint32)
- func HashTag(key []byte) []byte
- func HashTagToSlot(tag []byte) uint32
- func IsExpired(expireat int64) bool
- func Num64(i interface{}) interface{}
- func ParseFloat(i interface{}) (float64, error)
- func ParseInt(i interface{}) (int64, error)
- func ParseUint(i interface{}) (uint64, error)
- func TTLmsToExpireAt(ttlms int64) (int64, bool)
- func TTLsToExpireAt(ttls int64) (int64, bool)
- type BufReader
- func (r *BufReader) Len() int
- func (r *BufReader) ReadByte() (byte, error)
- func (r *BufReader) ReadBytes(n int) ([]byte, error)
- func (r *BufReader) ReadFloat64() (float64, error)
- func (r *BufReader) ReadInt64() (int64, error)
- func (r *BufReader) ReadUint64() (uint64, error)
- func (r *BufReader) ReadUvarint() (uint64, error)
- func (r *BufReader) ReadVarbytes() ([]byte, error)
- func (r *BufReader) ReadVarint() (int64, error)
- type BufWriter
- func (w *BufWriter) Bytes() []byte
- func (w *BufWriter) Len() int
- func (w *BufWriter) WriteByte(b byte) error
- func (w *BufWriter) WriteBytes(p []byte) error
- func (w *BufWriter) WriteFloat64(f float64) error
- func (w *BufWriter) WriteInt64(s int64) error
- func (w *BufWriter) WriteUint64(s uint64) error
- func (w *BufWriter) WriteUvarint(v uint64) error
- func (w *BufWriter) WriteVarbytes(p []byte) error
- func (w *BufWriter) WriteVarint(v int64) error
- type Forward
- type ForwardHandler
- type ObjectCode
- type Store
- func (s *Store) Acquire() error
- func (s *Store) Append(db uint32, args [][]byte) (int64, error)
- func (s *Store) Close()
- func (s *Store) CompactAll() error
- func (s *Store) Decr(db uint32, args [][]byte) (int64, error)
- func (s *Store) DecrBy(db uint32, args [][]byte) (int64, error)
- func (s *Store) Del(db uint32, args [][]byte) (int64, error)
- func (s *Store) Dump(db uint32, args [][]byte) (interface{}, error)
- func (s *Store) Exists(db uint32, args [][]byte) (int64, error)
- func (s *Store) Expire(db uint32, args [][]byte) (int64, error)
- func (s *Store) ExpireAt(db uint32, args [][]byte) (int64, error)
- func (s *Store) Get(db uint32, args [][]byte) ([]byte, error)
- func (s *Store) GetBit(db uint32, args [][]byte) (int64, error)
- func (s *Store) GetRange(db uint32, args [][]byte) ([]byte, error)
- func (s *Store) GetSet(db uint32, args [][]byte) ([]byte, error)
- func (s *Store) HDel(db uint32, args [][]byte) (int64, error)
- func (s *Store) HExists(db uint32, args [][]byte) (int64, error)
- func (s *Store) HGet(db uint32, args [][]byte) ([]byte, error)
- func (s *Store) HGetAll(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) HIncrBy(db uint32, args [][]byte) (int64, error)
- func (s *Store) HIncrByFloat(db uint32, args [][]byte) (float64, error)
- func (s *Store) HKeys(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) HLen(db uint32, args [][]byte) (int64, error)
- func (s *Store) HMGet(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) HMSet(db uint32, args [][]byte) error
- func (s *Store) HSet(db uint32, args [][]byte) (int64, error)
- func (s *Store) HSetNX(db uint32, args [][]byte) (int64, error)
- func (s *Store) HVals(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) Incr(db uint32, args [][]byte) (int64, error)
- func (s *Store) IncrBy(db uint32, args [][]byte) (int64, error)
- func (s *Store) IncrByFloat(db uint32, args [][]byte) (float64, error)
- func (s *Store) Info() (string, error)
- func (s *Store) LIndex(db uint32, args [][]byte) ([]byte, error)
- func (s *Store) LLen(db uint32, args [][]byte) (int64, error)
- func (s *Store) LPop(db uint32, args [][]byte) ([]byte, error)
- func (s *Store) LPush(db uint32, args [][]byte) (int64, error)
- func (s *Store) LPushX(db uint32, args [][]byte) (int64, error)
- func (s *Store) LRange(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) LSet(db uint32, args [][]byte) error
- func (s *Store) LTrim(db uint32, args [][]byte) error
- func (s *Store) MGet(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) MSet(db uint32, args [][]byte) error
- func (s *Store) MSetNX(db uint32, args [][]byte) (int64, error)
- func (s *Store) NewSnapshot() (*StoreSnapshot, error)
- func (s *Store) NewSnapshotFunc(f func()) (*StoreSnapshot, error)
- func (s *Store) PExpire(db uint32, args [][]byte) (int64, error)
- func (s *Store) PExpireAt(db uint32, args [][]byte) (int64, error)
- func (s *Store) PSetEX(db uint32, args [][]byte) error
- func (s *Store) PTTL(db uint32, args [][]byte) (int64, error)
- func (s *Store) Persist(db uint32, args [][]byte) (int64, error)
- func (s *Store) RPop(db uint32, args [][]byte) ([]byte, error)
- func (s *Store) RPush(db uint32, args [][]byte) (int64, error)
- func (s *Store) RPushX(db uint32, args [][]byte) (int64, error)
- func (s *Store) RegPostCommitHandler(h ForwardHandler)
- func (s *Store) RegPreCommitHandler(h ForwardHandler)
- func (s *Store) Release()
- func (s *Store) ReleaseSnapshot(sp *StoreSnapshot)
- func (s *Store) Reset() error
- func (s *Store) Restore(db uint32, args [][]byte) error
- func (s *Store) SAdd(db uint32, args [][]byte) (int64, error)
- func (s *Store) SCard(db uint32, args [][]byte) (int64, error)
- func (s *Store) SIsMember(db uint32, args [][]byte) (int64, error)
- func (s *Store) SMembers(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) SPop(db uint32, args [][]byte) ([]byte, error)
- func (s *Store) SRandMember(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) SRem(db uint32, args [][]byte) (int64, error)
- func (s *Store) Set(db uint32, args [][]byte) error
- func (s *Store) SetBit(db uint32, args [][]byte) (int64, error)
- func (s *Store) SetEX(db uint32, args [][]byte) error
- func (s *Store) SetNX(db uint32, args [][]byte) (int64, error)
- func (s *Store) SetRange(db uint32, args [][]byte) (int64, error)
- func (s *Store) SlotsInfo(db uint32, args [][]byte) (map[uint32]int64, error)
- func (s *Store) SlotsMgrtOne(db uint32, args [][]byte) (int64, error)
- func (s *Store) SlotsMgrtSlot(db uint32, args [][]byte) (int64, error)
- func (s *Store) SlotsMgrtTagOne(db uint32, args [][]byte) (int64, error)
- func (s *Store) SlotsMgrtTagSlot(db uint32, args [][]byte) (int64, error)
- func (s *Store) SlotsRestore(db uint32, args [][]byte) error
- func (s *Store) Strlen(db uint32, args [][]byte) (int64, error)
- func (s *Store) TTL(db uint32, args [][]byte) (int64, error)
- func (s *Store) Type(db uint32, args [][]byte) (ObjectCode, error)
- func (s *Store) ZAdd(db uint32, args [][]byte) (int64, error)
- func (s *Store) ZCard(db uint32, args [][]byte) (int64, error)
- func (s *Store) ZCount(db uint32, args [][]byte) (int64, error)
- func (s *Store) ZGetAll(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) ZIncrBy(db uint32, args [][]byte) (float64, error)
- func (s *Store) ZLexCount(db uint32, args [][]byte) (int64, error)
- func (s *Store) ZRange(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) ZRangeByLex(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) ZRangeByScore(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) ZRank(db uint32, args [][]byte) (int64, error)
- func (s *Store) ZRem(db uint32, args [][]byte) (int64, error)
- func (s *Store) ZRemRangeByLex(db uint32, args [][]byte) (int64, error)
- func (s *Store) ZRemRangeByRank(db uint32, args [][]byte) (int64, error)
- func (s *Store) ZRemRangeByScore(db uint32, args [][]byte) (int64, error)
- func (s *Store) ZRevRange(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) ZRevRangeByLex(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) ZRevRangeByScore(db uint32, args [][]byte) ([][]byte, error)
- func (s *Store) ZRevRank(db uint32, args [][]byte) (int64, error)
- func (s *Store) ZScore(db uint32, args [][]byte) (float64, bool, error)
- type StoreSnapshot
Constants ¶
const ( MetaCode = byte('#') DataCode = byte('&') )
const (
MaxExpireAt = 1e15
)
const (
MaxSlotNum = 1024
)
Variables ¶
var ( ErrNoSuchList = errors.New("no such list") ErrOutOfRange = errors.New("index out of range") )
var ( ErrMetaKey = errors.New("invalid meta key") ErrDataKey = errors.New("invalid data key") ErrNotMatched = errors.New("unmatched raw bytes") ErrObjectCode = errors.New("invalid object code") ErrObjectValue = errors.New("invalid object value") ErrNotString = errors.New("not string") ErrNotHash = errors.New("not hash") ErrNotList = errors.New("not list") ErrNotZSet = errors.New("not zset") ErrNotSet = errors.New("not set") )
var (
ErrClosed = errors.New("store has been closed")
)
var (
ErrSnapClosed = errors.New("store snapshot has been closed")
)
var (
ErrVarbytesLen = errors.New("invalid varbytes length")
)
Functions ¶
func EncodeDataKeyPrefix ¶
func EncodeMetaKey ¶
func EncodeMetaKeyPrefixSlot ¶
func EncodeMetaKeyPrefixTag ¶
func ExpireAtToTTLms ¶
func FormatByte ¶
func FormatByte(arg interface{}) []byte
func FormatBytes ¶
func FormatBytes(args ...interface{}) [][]byte
func FormatFloat ¶
func FormatFloatString ¶
func FormatString ¶
func FormatString(i interface{}) string
func FormatUint ¶
func HashKeyToSlot ¶
func HashTagToSlot ¶
func ParseFloat ¶
func TTLmsToExpireAt ¶
func TTLsToExpireAt ¶
Types ¶
type BufReader ¶
type BufReader struct {
// contains filtered or unexported fields
}
func NewBufReader ¶
func (*BufReader) ReadFloat64 ¶
func (*BufReader) ReadUint64 ¶
func (*BufReader) ReadUvarint ¶
func (*BufReader) ReadVarbytes ¶
func (*BufReader) ReadVarint ¶
type BufWriter ¶
type BufWriter struct {
// contains filtered or unexported fields
}
func NewBufWriter ¶
func (*BufWriter) WriteBytes ¶
func (*BufWriter) WriteFloat64 ¶
func (*BufWriter) WriteInt64 ¶
func (*BufWriter) WriteUint64 ¶
func (*BufWriter) WriteUvarint ¶
func (*BufWriter) WriteVarbytes ¶
func (*BufWriter) WriteVarint ¶
type ForwardHandler ¶
type ObjectCode ¶
type ObjectCode byte
const ( StringCode ObjectCode = 'K' HashCode ObjectCode = 'H' ListCode ObjectCode = 'L' ZSetCode ObjectCode = 'Z' SetCode ObjectCode = 'S' )
func (ObjectCode) String ¶
func (c ObjectCode) String() string
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) CompactAll ¶
func (*Store) HIncrByFloat ¶
HINCRBYFLOAT key field delta
func (*Store) IncrByFloat ¶
INCRBYFLOAT key delta
func (*Store) NewSnapshot ¶
func (s *Store) NewSnapshot() (*StoreSnapshot, error)
func (*Store) NewSnapshotFunc ¶
func (s *Store) NewSnapshotFunc(f func()) (*StoreSnapshot, error)
New a snapshot and then call f if not nil
func (*Store) RegPostCommitHandler ¶
func (s *Store) RegPostCommitHandler(h ForwardHandler)
Register the handler that will be called after db storage committed
func (*Store) RegPreCommitHandler ¶
func (s *Store) RegPreCommitHandler(h ForwardHandler)
Register the handler that will be called before db storage commit
func (*Store) ReleaseSnapshot ¶
func (s *Store) ReleaseSnapshot(sp *StoreSnapshot)
func (*Store) SRandMember ¶
SRANDMEMBER key [count]
func (*Store) SlotsMgrtOne ¶
SLOTSMGRTONE host port timeout key
func (*Store) SlotsMgrtSlot ¶
SLOTSMGRTSLOT host port timeout slot
func (*Store) SlotsMgrtTagOne ¶
SLOTSMGRTTAGONE host port timeout key
func (*Store) SlotsMgrtTagSlot ¶
SLOTSMGRTTAGSLOT host port timeout slot
func (*Store) SlotsRestore ¶
SLOTSRESTORE key ttlms value [key ttlms value ...]
func (*Store) ZRangeByLex ¶
ZRANGEBYLEX key min max [LIMIT offset count]
func (*Store) ZRangeByScore ¶
ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]
func (*Store) ZRemRangeByLex ¶
ZREMRANGEBYLEX key min max
func (*Store) ZRemRangeByRank ¶
ZREMRANGEBYRANK key start stop
func (*Store) ZRemRangeByScore ¶
ZREMRANGEBYSCORE key min max
func (*Store) ZRevRangeByLex ¶
ZRevRANGEBYLEX key min max [LIMIT offset count]
func (*Store) ZRevRangeByScore ¶
ZREVRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]
type StoreSnapshot ¶
type StoreSnapshot struct {
// contains filtered or unexported fields
}
func (*StoreSnapshot) Close ¶
func (s *StoreSnapshot) Close()