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) PrefixScan(prefix []byte, handler func(key, value []byte) (bool, error), pooledKey bool) error
- func (s *Storage) RangeDelete(start, end []byte) error
- func (s *Storage) RemoveShardData(shard bhmetapb.Shard, encodedStartKey, encodedEndKey []byte) error
- func (s *Storage) Scan(start, end []byte, handler func(key, value []byte) (bool, error), ...) error
- func (s *Storage) Seek(key []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, uint64, [][]byte, error)
- func (s *Storage) Stats() stats.Stats
- func (s *Storage) Sync() 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 {
// SyncCount number of `Sync` method called
SyncCount uint64
// contains filtered or unexported fields
}
Storage memory storage
func NewStorage ¶
NewStorage returns a mem data storage with snapshot data backed by the specified vfs
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) PrefixScan ¶
func (s *Storage) PrefixScan(prefix []byte, handler func(key, value []byte) (bool, error), pooledKey bool) error
PrefixScan scans the key-value pairs starts from prefix but only keys for the same prefix, while 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) RangeDelete ¶
RangeDelete remove data in [start,end)
func (*Storage) RemoveShardData ¶
func (s *Storage) RemoveShardData(shard bhmetapb.Shard, encodedStartKey, encodedEndKey []byte) error
RemoveShardData remove shard data
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