db

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: GPL-3.0 Imports: 19 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TeardownDB

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

TeardownDB cleans up a test DB 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 NewKVStore

func NewKVStore(dirPath string, pubKeys [][48]byte) (*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 SetupDB

func SetupDB(t testing.TB, pubkeys [][48]byte) *Store

SetupDB instantiates and returns a DB instance for the validator client.

func (*Store) AttestationHistory

func (db *Store) AttestationHistory(ctx context.Context, publicKey []byte) (*slashpb.AttestationHistory, error)

AttestationHistory accepts a validator public key and returns the corresponding attestation history. Returns nil if there is no attestation history for the validator.

func (*Store) ClearDB

func (db *Store) ClearDB() error

ClearDB removes any previously stored data at the configured 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) DeleteAttestationHistory

func (db *Store) DeleteAttestationHistory(ctx context.Context, pubkey []byte) error

DeleteAttestationHistory deletes the attestation history for the corresponding validator public key.

func (*Store) DeleteProposalHistory

func (db *Store) DeleteProposalHistory(ctx context.Context, pubkey []byte) error

DeleteProposalHistory deletes the proposal history for the corresponding validator public key.

func (*Store) ProposalHistoryForEpoch

func (db *Store) ProposalHistoryForEpoch(ctx context.Context, publicKey []byte, epoch uint64) (bitfield.Bitlist, error)

ProposalHistoryForEpoch accepts a validator public key and returns the corresponding proposal history. Returns nil if there is no proposal history for the validator.

func (*Store) SaveAttestationHistory

func (db *Store) SaveAttestationHistory(ctx context.Context, pubKey []byte, attestationHistory *slashpb.AttestationHistory) error

SaveAttestationHistory returns the attestation history for the requested validator public key.

func (*Store) SaveProposalHistoryForEpoch

func (db *Store) SaveProposalHistoryForEpoch(ctx context.Context, pubKey []byte, epoch uint64, slotBits bitfield.Bitlist) error

SaveProposalHistoryForEpoch returns the proposal history for the requested validator public key.

func (*Store) Size

func (db *Store) Size() (int64, error)

Size returns the db size in bytes.

Directories

Path Synopsis
Package iface exists to prevent circular dependencies when implementing the database interface.
Package iface exists to prevent circular dependencies when implementing the database interface.

Jump to

Keyboard shortcuts

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