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: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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