bolt

package
v2.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultFilename = "influxd.bolt"

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

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

Bucket implements kv.Bucket.

func (*Bucket) Cursor

func (b *Bucket) Cursor(opts ...kv.CursorHint) (kv.Cursor, error)

Cursor retrieves a cursor for iterating through the entries in the key value store.

func (*Bucket) Delete

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

Delete removes the provided key.

func (*Bucket) ForwardCursor

func (b *Bucket) ForwardCursor(seek []byte, opts ...kv.CursorOption) (kv.ForwardCursor, error)

ForwardCursor retrieves a cursor for iterating through the entries in the key value store in a given direction (ascending / descending).

func (*Bucket) Get

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

Get retrieves the value at the provided key.

func (*Bucket) Put

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

Put sets the value at the provided key.

type Client

type Client struct {
	Path string

	IDGenerator    platform.IDGenerator
	TokenGenerator platform.TokenGenerator
	platform.TimeGenerator
	// contains filtered or unexported fields
}

Client is a client for the boltDB data store.

func NewClient

func NewClient(log *zap.Logger) *Client

NewClient returns an instance of a Client.

func (*Client) Close

func (c *Client) Close() error

Close the connection to the bolt database

func (*Client) Collect

func (c *Client) Collect(ch chan<- prometheus.Metric)

Collect returns the current state of all metrics of the collector.

func (*Client) DB

func (c *Client) DB() *bolt.DB

DB returns the clients DB.

func (*Client) Describe

func (c *Client) Describe(ch chan<- *prometheus.Desc)

Describe returns all descriptions of the collector.

func (*Client) ID

func (c *Client) ID() platform.ID

ID retrieves the unique ID for this influx instance.

func (*Client) Open

func (c *Client) Open(ctx context.Context) error

Open / create boltDB file.

type Cursor

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

Cursor is a struct for iterating through the entries in the key value store.

func (*Cursor) Close

func (c *Cursor) Close() error

Close sets the closed to closed

func (*Cursor) Err

func (c *Cursor) Err() error

Err always returns nil as nothing can go wrong™ during iteration

func (*Cursor) First

func (c *Cursor) First() ([]byte, []byte)

First retrieves the first key value pair in the bucket.

func (*Cursor) Last

func (c *Cursor) Last() ([]byte, []byte)

Last retrieves the last key value pair in the bucket.

func (*Cursor) Next

func (c *Cursor) Next() (k []byte, v []byte)

Next retrieves the next key in the bucket.

func (*Cursor) Prev

func (c *Cursor) Prev() (k []byte, v []byte)

Prev retrieves the previous key in the bucket.

func (*Cursor) Seek

func (c *Cursor) Seek(prefix []byte) ([]byte, []byte)

Seek seeks for the first key that matches the prefix provided.

type KVStore

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

KVStore is a kv.Store backed by boltdb.

func NewKVStore

func NewKVStore(log *zap.Logger, path string) *KVStore

NewKVStore returns an instance of KVStore with the file at the provided path.

func (*KVStore) Backup

func (s *KVStore) Backup(ctx context.Context, w io.Writer) error

Backup copies all K:Vs to a writer, in BoltDB format.

func (*KVStore) Close

func (s *KVStore) Close() error

Close the connection to the bolt database

func (*KVStore) Flush

func (s *KVStore) Flush(ctx context.Context)

Flush removes all bolt keys within each bucket.

func (*KVStore) Open

func (s *KVStore) Open(ctx context.Context) error

Open creates boltDB file it doesn't exists and opens it otherwise.

func (*KVStore) Update

func (s *KVStore) Update(ctx context.Context, fn func(tx kv.Tx) error) error

Update opens up an update transaction against the store.

func (*KVStore) View

func (s *KVStore) View(ctx context.Context, fn func(tx kv.Tx) error) error

View opens up a view transaction against the store.

func (*KVStore) WithDB

func (s *KVStore) WithDB(db *bolt.DB)

WithDB sets the boltdb on the store.

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, error)

Bucket retrieves the bucket named b.

func (*Tx) Context

func (tx *Tx) Context() context.Context

Context returns the context for the transaction.

func (*Tx) WithContext

func (tx *Tx) WithContext(ctx context.Context)

WithContext sets the context for the transaction.

Jump to

Keyboard shortcuts

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