boltdb

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(name, dir string) (tmdb.DB, error)

NewDB returns a BoltDB with default options.

func NewDBWithOpts

func NewDBWithOpts(name string, dir string, opts *bbolt.Options) (tmdb.DB, error)

NewDBWithOpts allows you to supply *bbolt.Options. ReadOnly: true is not supported because NewDBWithOpts creates a global bucket.

Types

type BoltDB

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

BoltDB is a wrapper around etcd's fork of bolt (https://github.com/etcd-io/bbolt).

NOTE: All operations (including Set, Delete) are synchronous by default. One can globally turn it off by using NoSync config option (not recommended).

A single bucket ([]byte("tm")) is used per a database instance. This could lead to performance issues when/if there will be lots of keys.

func (*BoltDB) Close

func (bdb *BoltDB) Close() error

Close implements DB.

func (*BoltDB) Delete

func (bdb *BoltDB) Delete(key []byte) error

Delete implements DB.

func (*BoltDB) DeleteSync

func (bdb *BoltDB) DeleteSync(key []byte) error

DeleteSync implements DB.

func (*BoltDB) Get

func (bdb *BoltDB) Get(key []byte) (value []byte, err error)

Get implements DB.

func (*BoltDB) Has

func (bdb *BoltDB) Has(key []byte) (bool, error)

Has implements DB.

func (*BoltDB) Iterator

func (bdb *BoltDB) Iterator(start, end []byte) (tmdb.Iterator, error)

WARNING: Any concurrent writes or reads will block until the iterator is closed.

func (*BoltDB) NewBatch

func (bdb *BoltDB) NewBatch() tmdb.Batch

NewBatch implements DB.

func (*BoltDB) Print

func (bdb *BoltDB) Print() error

Print implements DB.

func (*BoltDB) ReverseIterator

func (bdb *BoltDB) ReverseIterator(start, end []byte) (tmdb.Iterator, error)

WARNING: Any concurrent writes or reads will block until the iterator is closed.

func (*BoltDB) Set

func (bdb *BoltDB) Set(key, value []byte) error

Set implements DB.

func (*BoltDB) SetSync

func (bdb *BoltDB) SetSync(key, value []byte) error

SetSync implements DB.

func (*BoltDB) Stats

func (bdb *BoltDB) Stats() map[string]string

Stats implements DB.

Jump to

Keyboard shortcuts

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