bolt

package
v0.0.0-...-bdd3411 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Destroy

func Destroy(path string) error

Destroy destroys the DB at the given path.

func New

func New(db *bolt.DB) *kvq.DB

New returns a DB from the given Bolt DB instance.

func Open

func Open(path string) (*kvq.DB, error)

Open returns a DB instance from the Bolt database at the given path, using default parameters.

Types

type Batch

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

Batch represents a set of put/delete operations to perform on a Queue.

func (*Batch) Close

func (b *Batch) Close()

Close discards this batch.

func (*Batch) Delete

func (b *Batch) Delete(k []byte) error

Delete deletes the key `k`.

func (*Batch) Put

func (b *Batch) Put(k, v []byte) error

Put sets the key `k` to value `v`.

type Bucket

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

Bucket represents a set of keys within a DB.

func (*Bucket) Batch

func (q *Bucket) Batch(fn func(backend.Batch) error) error

Batch enacts a number of operations in one atomic go. If the batch function returns a non-nil error, the batch is discarded and the error is returned to the caller. If the batch function returns nil, the batch is committed to the queue.

func (*Bucket) Clear

func (q *Bucket) Clear() error

Clear removes all items from this bucket.

func (*Bucket) ForEach

func (q *Bucket) ForEach(fn func(k, v []byte) error) error

ForEach iterates through keys in the bucket. If the iteration function returns a non-nil error, iteration stops and the error is returned to the caller.

func (*Bucket) Get

func (q *Bucket) Get(k []byte) ([]byte, error)

Get returns the value stored at key `k`.

type DB

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

DB encapsulates a Bolt DB instance.

func (*DB) Bucket

func (db *DB) Bucket(name string) (backend.Bucket, error)

Bucket returns a queue in the given namespace.

func (*DB) Close

func (db *DB) Close()

Close closes the bolt database and releases any resources.

Jump to

Keyboard shortcuts

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