bolt

package
v0.0.0-...-0b6d2f4 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: AGPL-3.0, AGPL-3.0-or-later Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrUnableToOpen means we had an issue establishing a connection (or creating the database)
	ErrUnableToOpen = "Unable to open boltdb; is there a chronograf already running?  %v"
	// ErrUnableToBackup means we couldn't copy the db file into ./backup
	ErrUnableToBackup = "Unable to backup your database prior to migrations:  %v"
	// ErrUnableToInitialize means we couldn't create missing Buckets (maybe a timeout)
	ErrUnableToInitialize = "Unable to boot boltdb:  %v"
	// ErrUnableToUpdate means we had an issue changing the db schema
	ErrUnableToUpdate = "Unable to store new version in boltdb:  %v"
)

Variables

This section is empty.

Functions

func NewClient

func NewClient(ctx context.Context, opts ...Option) (*client, error)

NewClient initializes bolt client implementing the kv.Store interface.

Types

type Bucket

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

Bucket implements kv.Bucket.

func (*Bucket) Delete

func (b *Bucket) Delete(key []byte) error

Delete removes the provided key.

func (*Bucket) ForEach

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

ForEach executes a function for each key/value pair in a bucket. If the provided function returns an error then the iteration is stopped and the error is returned to the caller. The provided function must not modify the bucket; this will result in undefined behavior.

func (*Bucket) Get

func (b *Bucket) Get(key []byte) ([]byte, error)

Get retrieves the value at the provided key.

func (*Bucket) NextSequence

func (b *Bucket) NextSequence() (uint64, error)

NextSequence calls NextSequence on the bolt bucket.

func (*Bucket) Put

func (b *Bucket) Put(key []byte, value []byte) error

Put sets the value at the provided key.

type Option

type Option func(c *client) error

Option to change behavior of Open()

func WithBuildInfo

func WithBuildInfo(bi chronograf.BuildInfo) Option

WithBuildInfo allows for setting this chronograf's build info.

func WithLogger

func WithLogger(logger chronograf.Logger) Option

WithLogger allows for setting this chronograf's logger.

func WithPath

func WithPath(path string) Option

WithPath sets the path to the boltdb.

type Tx

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

Tx is a light wrapper around a boltdb transaction. It implements kv.Tx.

func (*Tx) Bucket

func (tx *Tx) Bucket(b []byte) kv.Bucket

Bucket retrieves the bucket named b.

func (*Tx) CreateBucketIfNotExists

func (tx *Tx) CreateBucketIfNotExists(b []byte) (kv.Bucket, error)

CreateBucketIfNotExists creates a bucket with the provided byte slice.

Jump to

Keyboard shortcuts

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