boltdb

package
v2.0.5-testnet Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0, MIT Imports: 13 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

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

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

func (b *BoltStore) Close() error

func (*BoltStore) Cursor

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

func (*BoltStore) Del

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

func (*BoltStore) Get

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

Get returns the beacon saved at this round

func (*BoltStore) Last

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

Last returns the last beacon signature saved into the db

func (*BoltStore) Len

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

func (b *BoltStore) Put(ctx context.Context, beacon *common.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

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