pebble

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLogDBStorage

func CreateLogDBStorage(rootDir string, fs vfs.FS, logger *zap.Logger) storage.KVStorage

CreateLogDBStorage creates the underlying storage that will be used by the LogDB.

Types

type Storage

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

Storage returns a kv storage based on badger

func NewStorage

func NewStorage(dir string, logger *zap.Logger, opts *pebble.Options) (*Storage, error)

NewStorage returns a pebble backed kv store.

func (*Storage) Close

func (s *Storage) Close() error

Close close the storage

func (*Storage) Delete

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

Delete remove the key from the storage

func (*Storage) Get

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

Get returns the value of the key

func (*Storage) GetView

func (s *Storage) GetView() storage.View

func (*Storage) NewWriteBatch

func (s *Storage) NewWriteBatch() storage.Resetable

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

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

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.

func (*Storage) ScanInView

func (s *Storage) ScanInView(view storage.View,
	start, end []byte, handler func(key, value []byte) (bool, error), copy bool) error

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, value []byte, sync bool) error

Set put the key, value pair to the storage

func (*Storage) Stats

func (s *Storage) Stats() stats.Stats

func (*Storage) Sync

func (s *Storage) Sync() error

Sync persist data to disk

func (*Storage) Write

func (s *Storage) Write(uwb 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