Documentation
¶
Index ¶
- type Storage
- func (s *Storage) ApplySnapshot(path string) error
- func (s *Storage) BatchDelete(keys ...[]byte) error
- func (s *Storage) BatchSet(pairs ...[]byte) error
- func (s *Storage) Close() error
- func (s *Storage) CreateSnapshot(path string, start, end []byte) error
- func (s *Storage) Delete(key []byte) error
- func (s *Storage) Free(pooled []byte)
- func (s *Storage) Get(key []byte) ([]byte, error)
- func (s *Storage) MGet(keys ...[]byte) ([][]byte, error)
- func (s *Storage) RangeDelete(start, end []byte) error
- func (s *Storage) Scan(start, end []byte, handler func(key, value []byte) (bool, error), ...) error
- func (s *Storage) Seek(target []byte) ([]byte, []byte, error)
- func (s *Storage) Set(key []byte, value []byte) error
- func (s *Storage) SetWithTTL(key []byte, value []byte, ttl int32) error
- func (s *Storage) SplitCheck(start []byte, end []byte, size uint64) (uint64, []byte, error)
- func (s *Storage) Write(wb *util.WriteBatch, sync bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage returns a kv storage based on badger
func NewStorage ¶
NewStorage returns badger kv store on a default options
func NewStorageWithOptions ¶
NewStorageWithOptions returns badger kv store
func (*Storage) ApplySnapshot ¶
ApplySnapshot apply a snapshort file from giving path
func (*Storage) BatchDelete ¶
BatchDelete batch delete
func (*Storage) CreateSnapshot ¶
CreateSnapshot create a snapshot file under the giving path
func (*Storage) RangeDelete ¶
RangeDelete remove data in [start,end)
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) SetWithTTL ¶
SetWithTTL put the key, value pair to the storage with a ttl in seconds
func (*Storage) SplitCheck ¶
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