Documentation
¶
Index ¶
- func CreateLogDBStorage(rootDir string, fs vfs.FS, logger *zap.Logger) storage.KVStorage
- type Storage
- func (s *Storage) Close() error
- func (s *Storage) Delete(key []byte, sync bool) error
- func (s *Storage) Get(key []byte) ([]byte, error)
- func (s *Storage) GetView() storage.View
- func (s *Storage) NewWriteBatch() storage.Resetable
- func (s *Storage) PrefixScan(prefix []byte, handler func(key, value []byte) (bool, error), copy bool) error
- func (s *Storage) RangeDelete(start, end []byte, sync bool) error
- func (s *Storage) Scan(start, end []byte, handler func(key, value []byte) (bool, error), copy bool) error
- func (s *Storage) ScanInView(view storage.View, start, end []byte, ...) error
- func (s *Storage) Seek(target []byte) ([]byte, []byte, error)
- func (s *Storage) Set(key, value []byte, sync bool) error
- func (s *Storage) Stats() stats.Stats
- func (s *Storage) Sync() error
- func (s *Storage) Write(uwb util.WriteBatch, sync bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage returns a kv storage based on badger
func NewStorage ¶
NewStorage returns a pebble backed kv store.
func (*Storage) NewWriteBatch ¶
NewWriteBatch create and returns write batch
func (*Storage) PrefixScan ¶
func (s *Storage) PrefixScan(prefix []byte, handler func(key, value []byte) (bool, error), copy 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. The Handler func will received a cloned the key and value, if the `copy` is true.
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), copy bool) error
Scan scans the key-value pairs in [start, end), and perform with a handler function, if the function returns false, the scan will be terminated. The Handler func will received a cloned the key and value, if the `copy` is true.