badgerpack

package
v0.0.0-...-1c30942 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: ISC Imports: 6 Imported by: 0

Documentation

Overview

Package badgerpack implements the kvpack drivers using BadgerDB.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(opts badger.Options) (*kvpack.Database, error)

Open opens a new Badger database wrapped inside a driver.Database-compatible implementation.

Types

type DB

type DB badger.DB

DB implements driver.Database.

func (*DB) Begin

func (db *DB) Begin(_ []byte, ro bool) (driver.Transaction, error)

Begin starts a transaction. The namespace is ignored, because the keys already includes the namespace.

func (*DB) Close

func (db *DB) Close() error

Close closes the database.

type Txn

type Txn struct {
	*badger.Txn
	// contains filtered or unexported fields
}

Txn implements driver.Transaction.

func (*Txn) Commit

func (txn *Txn) Commit() error

Commit commits the current transaction.

func (*Txn) DeletePrefix

func (txn *Txn) DeletePrefix(prefix []byte) error

DeletePrefix deletes all keys with the given prefix.

func (*Txn) Get

func (txn *Txn) Get(k []byte) ([]byte, error)

Get gets the value with the given key.

func (*Txn) Iterate

func (txn *Txn) Iterate(prefix []byte, fn func(k, v []byte) error) error

Iterate iterates over all keys with the given prefix in lexicographic order.

func (*Txn) IterateKey

func (txn *Txn) IterateKey(prefix []byte, fn func(k []byte) error) error

IterateKey iterates over all keys with the given prefix in lexicographic order.

func (*Txn) Preload

func (txn *Txn) Preload(prefix []byte)

Preload preloads the given prefix.

func (*Txn) Put

func (txn *Txn) Put(k, v []byte) error

Put puts the given value into the given key.

func (*Txn) Rollback

func (txn *Txn) Rollback() error

Rollback discards the current transaction.

func (*Txn) Unload

func (txn *Txn) Unload(prefix []byte)

Unload unloads the given prefix.

Jump to

Keyboard shortcuts

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