pebble

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDiscardedTransaction = errors.New("discarded txn")

Functions

func New

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

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

func NewMem

func NewMem() (db.DB, error)

NewMem opens a new in-memory database

func NewMemTest

func NewMemTest(t *testing.T) db.DB

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

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

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) (*Item, error)

type Transaction

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

func (*Transaction) Commit

func (t *Transaction) Commit() error

Commit : see db.Transaction.Commit

func (*Transaction) Delete

func (t *Transaction) Delete(key []byte) error

Delete : see db.Transaction.Delete

func (*Transaction) Discard

func (t *Transaction) Discard() error

Discard : see db.Transaction.Discard

func (*Transaction) Get

func (t *Transaction) Get(key []byte, cb func([]byte) error) error

Get : see db.Transaction.Get

func (*Transaction) Impl

func (t *Transaction) Impl() any

Impl : see db.Transaction.Impl

func (*Transaction) NewIterator

func (t *Transaction) NewIterator() (db.Iterator, error)

NewIterator : see db.Transaction.NewIterator

func (*Transaction) Set

func (t *Transaction) Set(key, val []byte) error

Set : see db.Transaction.Set

Jump to

Keyboard shortcuts

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