pebble

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func New

func New(path string) (db.DB, error)

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

func NewBatch added in v0.12.3

func NewBatch(dbBatch *pebble.Batch, lock *sync.Mutex, listener db.EventListener) *batch

func NewMem

func NewMem() (db.DB, error)

NewMem opens a new in-memory database

func NewMemTest

func NewMemTest(t testing.TB) db.DB

NewMemTest opens a new in-memory database, panics on error

func NewSnapshot added in v0.12.3

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

func NewWithOptions added in v0.12.0

func NewWithOptions(path string, cacheSizeMB uint, maxOpenFiles int, colouredLogger bool) (db.DB, error)

Types

type DB

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

func (*DB) Close

func (d *DB) Close() error

Close : see io.Closer.Close

func (*DB) Impl

func (d *DB) Impl() any

Impl : see db.DB.Impl

func (*DB) NewTransaction

func (d *DB) NewTransaction(update bool) (db.Transaction, error)

NewTransaction : see db.DB.NewTransaction Batch is used for read-write operations, while snapshot is used for read-only operations

func (*DB) Update

func (d *DB) Update(fn func(txn db.Transaction) error) error

Update : see db.DB.Update

func (*DB) View

func (d *DB) View(fn func(txn db.Transaction) error) error

View : see db.DB.View

func (*DB) WithListener added in v0.7.0

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

WithListener registers an EventListener

type Item added in v0.12.1

type Item struct {
	Count uint
	Size  utils.DataSize
}

func CalculatePrefixSize added in v0.12.0

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

Jump to

Keyboard shortcuts

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