boltdb

package
v1.5.11 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const BoltFileName = "drand.db"

BoltFileName is the name of the file boltdb writes to

View Source
const BoltStoreOpenPerm = 0660

BoltStoreOpenPerm is the permission we will use to read bolt store file from disk

Variables

This section is empty.

Functions

func IsATest added in v1.5.3

func IsATest(ctx context.Context) context.Context

func NewBoltStore

func NewBoltStore(ctx context.Context, l log.Logger, folder string, opts *bolt.Options) (chain.Store, error)

NewBoltStore returns a Store implementation using the boltdb storage engine.

Types

type BoltStore added in v1.5.3

type BoltStore struct {
	sync.Mutex
	// contains filtered or unexported fields
}

BoltStore implements the Store interface using the kv storage boltdb (native golang implementation). Internally, Beacons are stored as JSON-encoded in the db file.

func (*BoltStore) Close added in v1.5.3

func (b *BoltStore) Close(context.Context) error

func (*BoltStore) Cursor added in v1.5.3

func (b *BoltStore) Cursor(ctx context.Context, fn func(context.Context, chain.Cursor) error) error

func (*BoltStore) Del added in v1.5.3

func (b *BoltStore) Del(ctx context.Context, round uint64) error

func (*BoltStore) Get added in v1.5.3

func (b *BoltStore) Get(ctx context.Context, round uint64) (*chain.Beacon, error)

Get returns the beacon saved at this round

func (*BoltStore) Last added in v1.5.3

func (b *BoltStore) Last(ctx context.Context) (*chain.Beacon, error)

Last returns the last beacon signature saved into the db

func (*BoltStore) Len added in v1.5.3

func (b *BoltStore) Len(ctx context.Context) (int, error)

Len performs a big scan over the bucket and is _very_ slow - use sparingly!

func (*BoltStore) Put added in v1.5.3

func (b *BoltStore) Put(ctx context.Context, beacon *chain.Beacon) error

Put implements the Store interface. WARNING: It does NOT verify that this beacon is not already saved in the database or not and will overwrite it.

func (*BoltStore) SaveTo added in v1.5.3

func (b *BoltStore) SaveTo(ctx context.Context, w io.Writer) error

SaveTo saves the bolt database to an alternate file.

Jump to

Keyboard shortcuts

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