db

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TeardownSlasherDB

func TeardownSlasherDB(t testing.TB, db *Store)

TeardownSlasherDB cleans up a test BeaconDB instance.

func TempDir

func TempDir() string

TempDir returns a directory path for temporary test storage.

Types

type Store

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

Store defines an implementation of the Prysm Database interface using BoltDB as the underlying persistent kv-store for eth2.

func NewDB

func NewDB(dirPath string) (*Store, error)

NewDB initializes a new DB.

func NewKVStore

func NewKVStore(dirPath string) (*Store, error)

NewKVStore initializes a new boltDB key-value store at the directory path specified, creates the kv-buckets based on the schema, and stores an open connection db object as a property of the Store struct.

func SetupSlasherDB

func SetupSlasherDB(t testing.TB) *Store

SetupSlasherDB instantiates and returns a SlasherDB instance.

func (*Store) BlockHeader

func (db *Store) BlockHeader(epoch uint64, validatorID uint64) ([]*ethpb.BeaconBlockHeader, error)

BlockHeader accepts an epoch and validator id and returns the corresponding block header array. Returns nil if the block header for those values does not exist.

func (*Store) ClearDB

func (db *Store) ClearDB() error

ClearDB removes the previously stored directory at the data directory.

func (*Store) Close

func (db *Store) Close() error

Close closes the underlying boltdb database.

func (*Store) DatabasePath

func (db *Store) DatabasePath() string

DatabasePath at which this database writes files.

func (*Store) DeleteBlockHeader

func (db *Store) DeleteBlockHeader(epoch uint64, validatorID uint64, blockHeader *ethpb.BeaconBlockHeader) error

DeleteBlockHeader deletes a block header using the epoch and validator id.

func (*Store) DeleteIndexedAttestation

func (db *Store) DeleteIndexedAttestation(epoch uint64, idxAttestation *ethpb.IndexedAttestation) error

DeleteIndexedAttestation deletes a indexed attestation using the slot and its root as keys in their respective buckets.

func (*Store) HasBlockHeader

func (db *Store) HasBlockHeader(epoch uint64, validatorID uint64) bool

HasBlockHeader accepts an epoch and validator id and returns true if the block header exists.

func (*Store) HasIndexedAttestation

func (db *Store) HasIndexedAttestation(epoch uint64, validatorID uint64) bool

HasIndexedAttestation accepts an epoch and validator id and returns true if the indexed attestation exists.

func (*Store) IndexedAttestation

func (db *Store) IndexedAttestation(epoch uint64, validatorID uint64) ([]*ethpb.IndexedAttestation, error)

IndexedAttestation accepts a epoch and validator index and returns a list of indexed attestations. Returns nil if the indexed attestation does not exist.

func (*Store) PruneHistory

func (db *Store) PruneHistory(currentEpoch uint64, historySize uint64) error

PruneHistory leaves only records younger then history size.

func (*Store) SaveBlockHeader

func (db *Store) SaveBlockHeader(epoch uint64, validatorID uint64, blockHeader *ethpb.BeaconBlockHeader) error

SaveBlockHeader accepts a block header and writes it to disk.

func (*Store) SaveIndexedAttestation

func (db *Store) SaveIndexedAttestation(epoch uint64, idxAttestation *ethpb.IndexedAttestation) error

SaveIndexedAttestation accepts epoch and indexed attestation and writes it to disk.

Jump to

Keyboard shortcuts

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