boltdb

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0, UNKNOWN, UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(name, dir string) (db.DB, error)

New returns a BoltDB with default options.

func NewWithOptions

func NewWithOptions(name string, dir string, opts *bbolt.Options) (db.DB, error)

NewWithOptions allows you to supply *bbolt.Options. ReadOnly: true is not supported because NewWithOptions 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://go.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()

func (*BoltDB) Delete

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

func (*BoltDB) DeleteSync

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

func (*BoltDB) Get

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

func (*BoltDB) Has

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

func (*BoltDB) Iterator

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

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

func (*BoltDB) NewBatch

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

NewBatch returns a new batch.

func (*BoltDB) Print

func (bdb *BoltDB) Print()

func (*BoltDB) ReverseIterator

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

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

func (*BoltDB) Set

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

func (*BoltDB) SetSync

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

func (*BoltDB) Stats

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

Jump to

Keyboard shortcuts

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