bboltpack

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 bboltpack implements the kvpack drivers using Bolt.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(path string, mode os.FileMode, opts *bbolt.Options) (*kvpack.Database, error)

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

Types

type DB

type DB bbolt.DB

DB implements driver.Database.

func (*DB) Begin

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

Begin starts a transaction.

func (*DB) Close

func (db *DB) Close() error

Close closes the database.

type Tx

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

Tx implements driver.Transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the current transaction. Calling Commit multiple times does nothing and will return nil.

func (*Tx) DeletePrefix

func (tx *Tx) DeletePrefix(prefix []byte) error

DeletePrefix deletes all keys with the given prefix.

func (*Tx) Get

func (tx *Tx) Get(k []byte) ([]byte, error)

Get gets the value with the given key.

func (*Tx) Iterate

func (tx *Tx) Iterate(prefix []byte, fn func(k, v []byte) error) error

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

func (*Tx) NamespaceBucket

func (tx *Tx) NamespaceBucket() *bbolt.Bucket

NamespaceBucket returns the current namespace's bucket inside the transaction. If the transaction is read-only and no keys have been put before, then nil is returned.

func (*Tx) Put

func (tx *Tx) Put(k, v []byte) error

Put puts the given value into the given key.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback discards the current transaction.

Notes

Bugs

  • Iterate seems to have a bug if a new transaction is created every GetKVPack benchmark iteration; the workaround was to change it so that all iterations are done inside a transaction, but this doesn't fix the root issue.

Jump to

Keyboard shortcuts

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