bolt

package
v0.0.0-...-0183129 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = &bolt.Options{
	Timeout: 5 * time.Second,
}

Functions

This section is empty.

Types

type BoltStorage

type BoltStorage struct {
	Filename string
	// contains filtered or unexported fields
}

BoltStorage implements Storage using boltdb

This name stutters because it's convenient to dot-import core, which defines 'Storage'.

func NewStorage

func NewStorage(ctx *Context, filename string) (*BoltStorage, error)

NewStorage returns a BoltStorage based Storage

func (*BoltStorage) Add

func (b *BoltStorage) Add(ctx *Context, loc string, data *Pair) error

Add adds a pair to a location

func (*BoltStorage) Clear

func (b *BoltStorage) Clear(ctx *Context, loc string) (int64, error)

Clear removes a location and returns the number of records dropped

func (*BoltStorage) Close

func (b *BoltStorage) Close(ctx *Context) error

func (*BoltStorage) Delete

func (b *BoltStorage) Delete(ctx *Context, loc string) error

Delete removes a location and returns the number of records dropped

func (*BoltStorage) Destroy

func (b *BoltStorage) Destroy(ctx *Context) error

Destroy closes the database and deletes it

func (*BoltStorage) GetStats

func (b *BoltStorage) GetStats(ctx *Context, loc string) (StorageStats, error)

GetStats returns the stats for a location ToDo: store last record times

func (*BoltStorage) Health

func (b *BoltStorage) Health(ctx *Context) error

func (*BoltStorage) Load

func (b *BoltStorage) Load(ctx *Context, loc string) ([]Pair, error)

Load returns data for a location ToDo: should we return an error if there was no bucket for a location?

func (*BoltStorage) Remove

func (b *BoltStorage) Remove(ctx *Context, loc string, k []byte) (int64, error)

Remove a pair from a location, we only care about the key

Jump to

Keyboard shortcuts

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