nemo

package
v0.0.0-...-01d9b8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisHash

type RedisHash interface {
	// HSet redis hset command
	HSet(key, field, value []byte) (int64, error)
	// HGet redis HGet command
	HGet(key, field []byte) ([]byte, error)
	// HDel redis HDel command
	HDel(key []byte, fields ...[]byte) (int64, error)
	// HExists redis HExists command
	HExists(key, field []byte) (bool, error)
	// HKeys redis HKeys command
	HKeys(key []byte) ([][]byte, error)
	// HVals redis HVals command
	HVals(key []byte) ([][]byte, error)
	// HGetAll redis HGetAll command
	HGetAll(key []byte) ([][]byte, error)
	// HScanGet redis HScanGet command extend
	HScanGet(key, start []byte, count int) ([][]byte, error)
	// HLen redis HLen command extend
	HLen(key []byte) (int64, error)
	// HMGet redis HMGet command extend
	HMGet(key []byte, fields ...[]byte) ([][]byte, []error)
	// HMSet redis HMSet command extend
	HMSet(key []byte, fields, values [][]byte) error
	// HSetNX redis HSetNX command extend
	HSetNX(key, field, value []byte) (int64, error)
	// HStrLen redis HStrLen command extend
	HStrLen(key, field []byte) (int64, error)
	// HIncrBy redis HIncrBy command extend
	HIncrBy(key, field []byte, incrment int64) ([]byte, error)
}

RedisHash redis hash

type RedisKV

type RedisKV interface {
	// Set redis set command
	Set(key, value []byte, ttl int) error
	// MSet redis mset command
	MSet(keys [][]byte, values [][]byte) error
	// Get redis get command
	Get(key []byte) ([]byte, error)
	// IncrBy redis incrby command
	IncrBy(key []byte, incrment int64) (int64, error)
	// DecrBy redis decrby command
	DecrBy(key []byte, incrment int64) (int64, error)
	// GetSet redis getset command
	GetSet(key, value []byte) ([]byte, error)
	// Append redis append command
	Append(key, value []byte) (int64, error)
	// SetNX redis setnx command
	SetNX(key, value []byte) (int64, error)
	// StrLen redis setlen command
	StrLen(key []byte) (int64, error)
}

RedisKV redis kv

type RedisList

type RedisList interface {
	// LIndex redis LIndex command extend
	LIndex(key []byte, index int64) ([]byte, error)
	// LInsert redis LInsert command extend
	LInsert(key []byte, pos int, pivot []byte, value []byte) (int64, error)
	// LLen redis LLen command extend
	LLen(key []byte) (int64, error)
	// LPop redis LPop command extend
	LPop(key []byte) ([]byte, error)
	// LPush redis LPush command extend
	LPush(key []byte, values ...[]byte) (int64, error)
	// LPushX redis LPushX command extend
	LPushX(key []byte, value []byte) (int64, error)
	// LRange redis LRange command extend
	LRange(key []byte, begin int64, end int64) ([][]byte, error)
	// LRem redis LRem command extend
	LRem(key []byte, count int64, value []byte) (int64, error)
	// LSet redis LSet command extend
	LSet(key []byte, index int64, value []byte) error
	// LTrim redis LTrim command extend
	LTrim(key []byte, begin int64, end int64) error
	// RPop redis RPop command extend
	RPop(key []byte) ([]byte, error)
	// RPush redis RPush command extend
	RPush(key []byte, values ...[]byte) (int64, error)
	// RPushX redis RPushX command extend
	RPushX(key []byte, value []byte) (int64, error)
}

RedisList redis list

type RedisSet

type RedisSet interface {
	// SAdd redis SAdd command extend
	SAdd(key []byte, members ...[]byte) (int64, error)
	// SRem redis SRem command extend
	SRem(key []byte, members ...[]byte) (int64, error)
	// SCard redis SCard command extend
	SCard(key []byte) (int64, error)
	// SMembers redis SMembers command extend
	SMembers(key []byte) ([][]byte, error)
	// SIsMember redis SIsMember command extend
	SIsMember(key []byte, member []byte) (int64, error)
	// SPop redis SPop command extend
	SPop(key []byte) ([]byte, error)
}

RedisSet redis set

type RedisZSet

type RedisZSet interface {
	// ZAdd redis ZAdd command extend
	ZAdd(key []byte, score float64, member []byte) (int64, error)
	// ZCard redis ZCard command extend
	ZCard(key []byte) (int64, error)
	// ZCount redis ZCount command extend
	ZCount(key []byte, min []byte, max []byte) (int64, error)
	// ZIncrBy redis ZIncrBy command extend
	ZIncrBy(key []byte, member []byte, by float64) ([]byte, error)
	// ZLexCount redis ZLexCount command extend
	ZLexCount(key []byte, min []byte, max []byte) (int64, error)
	// ZRange redis ZRange command extend
	ZRange(key []byte, start int64, stop int64) ([][]byte, error)
	// ZRangeByLex redis ZRangeByLex command extend
	ZRangeByLex(key []byte, min []byte, max []byte) ([][]byte, error)
	// ZRangeByScore redis ZRangeByScore command extend
	ZRangeByScore(key []byte, min []byte, max []byte) ([][]byte, error)
	// ZRank redis ZRank command extend
	ZRank(key []byte, member []byte) (int64, error)
	// ZRem redis ZRem command extend
	ZRem(key []byte, members ...[]byte) (int64, error)
	// ZRemRangeByLex redis ZRemRangeByLex command extend
	ZRemRangeByLex(key []byte, min []byte, max []byte) (int64, error)
	// ZRemRangeByRank redis ZRemRangeByRank command extend
	ZRemRangeByRank(key []byte, start int64, stop int64) (int64, error)
	// ZRemRangeByScore redis ZRemRangeByScore command extend
	ZRemRangeByScore(key []byte, min []byte, max []byte) (int64, error)
	// ZScore redis ZScore command extend
	ZScore(key []byte, member []byte) ([]byte, error)
}

RedisZSet redis zset

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

Storage nemo storage

func NewStorage

func NewStorage(dataPath string) (*Storage, error)

NewStorage create a storage based on nemo

func NewStorageWithOption

func NewStorageWithOption(dataPath, options string) (*Storage, error)

NewStorageWithOption create a storage based on nemo

func (*Storage) ApplySnapshot

func (s *Storage) ApplySnapshot(path string) error

ApplySnapshot apply a snapshort file from giving path

func (*Storage) BatchDelete

func (s *Storage) BatchDelete(keys ...[]byte) error

BatchDelete batch delete

func (*Storage) BatchSet

func (s *Storage) BatchSet(pairs ...[]byte) error

BatchSet batch set

func (*Storage) Close

func (s *Storage) Close() error

Close close the storage

func (*Storage) CreateSnapshot

func (s *Storage) CreateSnapshot(path string, start, end []byte) error

CreateSnapshot create a snapshot file under the giving path

func (*Storage) Delete

func (s *Storage) Delete(key []byte) error

Delete remove the key from the storage

func (*Storage) Free

func (s *Storage) Free(pooled []byte)

Free free the pooled bytes

func (*Storage) Get

func (s *Storage) Get(key []byte) ([]byte, error)

Get returns the value of the key

func (*Storage) MGet

func (s *Storage) MGet(keys ...[]byte) ([][]byte, error)

MGet returns multi values

func (*Storage) RangeDelete

func (s *Storage) RangeDelete(start, end []byte) error

RangeDelete remove data in [start,end)

func (*Storage) RedisHash

func (s *Storage) RedisHash() RedisHash

RedisHash returns a redis hash impl

func (*Storage) RedisKV

func (s *Storage) RedisKV() RedisKV

RedisKV returns a redis kv impl

func (*Storage) RedisList

func (s *Storage) RedisList() RedisList

RedisList returns a redis list impl

func (*Storage) RedisSet

func (s *Storage) RedisSet() RedisSet

RedisSet returns a redis set impl

func (*Storage) RedisZSet

func (s *Storage) RedisZSet() RedisZSet

RedisZSet returns a redis zset impl

func (*Storage) Scan

func (s *Storage) Scan(start, end []byte, handler func(key, value []byte) (bool, error), pooledKey bool) error

Scan scans the key-value paire in [start, end), and perform with a handler function, if the function returns false, the scan will be terminated, if the `pooledKey` is true, raftstore will call `Free` when scan completed.

func (*Storage) Seek

func (s *Storage) Seek(target []byte) ([]byte, []byte, error)

Seek returns the first key-value that >= key

func (*Storage) Set

func (s *Storage) Set(key []byte, value []byte) error

Set put the key, value pair to the storage

func (*Storage) SetWithTTL

func (s *Storage) SetWithTTL(key []byte, value []byte, ttl int32) error

SetWithTTL put the key, value pair to the storage with a ttl in seconds

func (*Storage) SplitCheck

func (s *Storage) SplitCheck(start []byte, end []byte, size uint64) (uint64, []byte, error)

SplitCheck Find a key from [start, end), so that the sum of bytes of the value of [start, key) <=size, returns the current bytes in [start,end), and the founded key

func (*Storage) Write

func (s *Storage) Write(wb *util.WriteBatch, sync bool) error

Write write the data in batch

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL