badger

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB implements the database.DB interface for server persistence.

func New

func New(l zerolog.Logger, path string) (*DB, error)

New returns a DB implementation that fulfills the Store interface.

func (*DB) Close

func (d *DB) Close() error

Close flushes any pending writes and closes the db.

func (*DB) Get

func (d *DB) Get(ctx context.Context, key string) ([]byte, error)

Get finds the value corresponding to the key and returns it or an error. If the key doesn't exist an error is returned.

func (*DB) GetKeys

func (d *DB) GetKeys(ctx context.Context, prefix string) ([]string, error)

GetKeys will range over DB keys and return the ones with the given prefix.

func (*DB) NewTransaction

func (d *DB) NewTransaction(ctx context.Context, update bool) (database.Transaction, context.Context, error)

NewTransaction starts a new transaction and returns a context that contains it. If the context is passed to other functions in this DB the transaction will be used for executing the operation.

func (*DB) Ping added in v0.5.1

func (d *DB) Ping(context.Context) error

func (*DB) Set

func (d *DB) Set(ctx context.Context, key string, value []byte) (err error)

Set will update a key with a given value and returns an error if anything went wrong.

Jump to

Keyboard shortcuts

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