pebblev2

package
v0.15.18 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TargetV1Version = pebble.FormatFlushableIngest
	TargetV2Version = pebblev2.FormatValueSeparation
)

Variables

View Source
var (
	ErrDiscardedTransaction = errors.New("discarded transaction")
	ErrReadOnlyTransaction  = errors.New("read-only transaction")
)

Functions

func New

func New(path string, options ...Option) (db.KeyValueStore, error)

New opens a new database at the given path with default options

func NewBatch

func NewBatch(dbBatch *pebble.Batch, db *DB, listener db.EventListener) *batch

func NewSnapshot

func NewSnapshot(db *pebble.DB, listener db.EventListener) *snapshot

Types

type DB

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

func (*DB) Close

func (d *DB) Close() error

func (*DB) Delete

func (d *DB) Delete(key []byte) error

func (*DB) DeleteRange

func (d *DB) DeleteRange(start, end []byte) error

func (*DB) Get

func (d *DB) Get(key []byte, cb func(value []byte) error) error

func (*DB) Has

func (d *DB) Has(key []byte) (bool, error)

func (*DB) Impl

func (d *DB) Impl() any

func (*DB) NewBatch

func (d *DB) NewBatch() db.Batch

func (*DB) NewBatchWithSize

func (d *DB) NewBatchWithSize(size int) db.Batch

func (*DB) NewIndexedBatch

func (d *DB) NewIndexedBatch() db.IndexedBatch

func (*DB) NewIndexedBatchWithSize

func (d *DB) NewIndexedBatchWithSize(size int) db.IndexedBatch

func (*DB) NewIterator

func (d *DB) NewIterator(prefix []byte, withUpperBound bool) (db.Iterator, error)

func (*DB) NewSnapshot

func (d *DB) NewSnapshot() db.Snapshot

func (*DB) Put

func (d *DB) Put(key, val []byte) error

func (*DB) Update

func (d *DB) Update(fn func(w db.IndexedBatch) error) error

func (*DB) View

func (d *DB) View(fn func(r db.Snapshot) error) error

func (*DB) WithListener

func (d *DB) WithListener(listener db.EventListener) db.KeyValueStore

type Item

type Item struct {
	Count uint
	Size  utils.DataSize
}

func CalculatePrefixSize

func CalculatePrefixSize(ctx context.Context, pDB *DB, prefix []byte, withUpperBound bool) (*Item, error)

type Option added in v0.15.11

type Option = func(*pebble.Options) error

func WithCacheSize added in v0.15.11

func WithCacheSize(cacheSizeMB uint) Option

func WithCompactionConcurrency added in v0.15.18

func WithCompactionConcurrency(concurrency string) Option

WithCompactionConcurrency sets the compaction concurrency range. Format: "N" sets lower=1, upper=N; "M,N" sets lower=M, upper=N. Empty string uses the default (1, GOMAXPROCS/2).

func WithCompression added in v0.15.11

func WithCompression(name string) Option

WithCompression sets the compression profile by name. Valid options: snappy (default), zstd (recommended for low storage), minlz.

func WithLogger added in v0.15.11

func WithLogger(colouredLogger bool) Option

func WithMaxOpenFiles added in v0.15.11

func WithMaxOpenFiles(maxOpenFiles int) Option

func WithMemtableSize added in v0.15.18

func WithMemtableSize(memtableSizeMB uint) Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL