kv

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2019 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VotesCacheSize with 1M validators will only be around 50Mb.
	VotesCacheSize = 1000000
)

Variables

View Source
var BlockCacheSize = int64(256)

BlockCacheSize specifies 4 epochs worth of blocks cached.

Functions

This section is empty.

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) (*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 (*Store) ArchivedActiveValidatorChanges

func (k *Store) ArchivedActiveValidatorChanges(ctx context.Context, epoch uint64) (*ethpb.ArchivedActiveSetChanges, error)

ArchivedActiveValidatorChanges retrieval by epoch.

func (*Store) ArchivedBalances

func (k *Store) ArchivedBalances(ctx context.Context, epoch uint64) ([]uint64, error)

ArchivedBalances retrieval by epoch.

func (*Store) ArchivedCommitteeInfo

func (k *Store) ArchivedCommitteeInfo(ctx context.Context, epoch uint64) (*ethpb.ArchivedCommitteeInfo, error)

ArchivedCommitteeInfo retrieval by epoch.

func (*Store) ArchivedValidatorParticipation

func (k *Store) ArchivedValidatorParticipation(ctx context.Context, epoch uint64) (*ethpb.ValidatorParticipation, error)

ArchivedValidatorParticipation retrieval by epoch.

func (*Store) Attestations

func (k *Store) Attestations(ctx context.Context, f *filters.QueryFilter) ([]*ethpb.Attestation, error)

Attestations retrieves a list of attestations by filter criteria.

func (*Store) AttestationsByDataRoot

func (k *Store) AttestationsByDataRoot(ctx context.Context, attDataRoot [32]byte) ([]*ethpb.Attestation, error)

AttestationsByDataRoot returns any (aggregated) attestations matching this data root.

func (*Store) AttesterSlashing

func (k *Store) AttesterSlashing(ctx context.Context, slashingRoot [32]byte) (*ethpb.AttesterSlashing, error)

AttesterSlashing retrieval by hash tree root.

func (*Store) Backup

func (k *Store) Backup(ctx context.Context) error

Backup the database to the datadir backup directory. Example for backup at slot 345: $DATADIR/backups/prysm_beacondb_at_slot_0000345.backup

func (*Store) Block

func (k *Store) Block(ctx context.Context, blockRoot [32]byte) (*ethpb.BeaconBlock, error)

Block retrieval by root.

func (*Store) BlockRoots

func (k *Store) BlockRoots(ctx context.Context, f *filters.QueryFilter) ([][32]byte, error)

BlockRoots retrieves a list of beacon block roots by filter criteria.

func (*Store) Blocks

func (k *Store) Blocks(ctx context.Context, f *filters.QueryFilter) ([]*ethpb.BeaconBlock, error)

Blocks retrieves a list of beacon blocks by filter criteria.

func (*Store) ClearDB

func (k *Store) ClearDB() error

ClearDB removes the previously stored database in the data directory.

func (*Store) Close

func (k *Store) Close() error

Close closes the underlying BoltDB database.

func (*Store) DatabasePath

func (k *Store) DatabasePath() string

DatabasePath at which this database writes files.

func (*Store) DeleteAttestation

func (k *Store) DeleteAttestation(ctx context.Context, attDataRoot [32]byte) error

DeleteAttestation by attestation data root.

func (*Store) DeleteAttestations

func (k *Store) DeleteAttestations(ctx context.Context, attDataRoots [][32]byte) error

DeleteAttestations by attestation data roots.

func (*Store) DeleteAttesterSlashing

func (k *Store) DeleteAttesterSlashing(ctx context.Context, slashingRoot [32]byte) error

DeleteAttesterSlashing clears an attester slashing from the db by its hash tree root.

func (*Store) DeleteBlock

func (k *Store) DeleteBlock(ctx context.Context, blockRoot [32]byte) error

DeleteBlock by block root.

func (*Store) DeleteBlocks

func (k *Store) DeleteBlocks(ctx context.Context, blockRoots [][32]byte) error

DeleteBlocks by block roots.

func (*Store) DeleteProposerSlashing

func (k *Store) DeleteProposerSlashing(ctx context.Context, slashingRoot [32]byte) error

DeleteProposerSlashing clears a proposer slashing from the db by its hash tree root.

func (*Store) DeleteState

func (k *Store) DeleteState(ctx context.Context, blockRoot [32]byte) error

DeleteState by block root.

func (*Store) DeleteStates

func (k *Store) DeleteStates(ctx context.Context, blockRoots [][32]byte) error

DeleteStates by block roots.

func (*Store) DeleteValidatorIndex

func (k *Store) DeleteValidatorIndex(ctx context.Context, publicKey [48]byte) error

DeleteValidatorIndex clears a validator index from the db by the validator's public key.

func (*Store) DeleteValidatorLatestVote

func (k *Store) DeleteValidatorLatestVote(ctx context.Context, validatorIdx uint64) error

DeleteValidatorLatestVote from the db.

func (*Store) DeleteVoluntaryExit

func (k *Store) DeleteVoluntaryExit(ctx context.Context, exitRoot [32]byte) error

DeleteVoluntaryExit clears a voluntary exit from the db by its signing root.

func (*Store) DepositContractAddress

func (k *Store) DepositContractAddress(ctx context.Context) ([]byte, error)

DepositContractAddress returns contract address is the address of the deposit contract on the proof of work chain.

func (*Store) FinalizedCheckpoint

func (k *Store) FinalizedCheckpoint(ctx context.Context) (*ethpb.Checkpoint, error)

FinalizedCheckpoint returns the latest finalized checkpoint in beacon chain.

func (*Store) GenesisState

func (k *Store) GenesisState(ctx context.Context) (*pb.BeaconState, error)

GenesisState returns the genesis state in beacon chain.

func (*Store) HasAttestation

func (k *Store) HasAttestation(ctx context.Context, attDataRoot [32]byte) bool

HasAttestation checks if an attestation by its attestation data root exists in the db.

func (*Store) HasAttesterSlashing

func (k *Store) HasAttesterSlashing(ctx context.Context, slashingRoot [32]byte) bool

HasAttesterSlashing verifies if a slashing is stored in the db.

func (*Store) HasBlock

func (k *Store) HasBlock(ctx context.Context, blockRoot [32]byte) bool

HasBlock checks if a block by root exists in the db.

func (*Store) HasProposerSlashing

func (k *Store) HasProposerSlashing(ctx context.Context, slashingRoot [32]byte) bool

HasProposerSlashing verifies if a slashing is stored in the db.

func (*Store) HasValidatorIndex

func (k *Store) HasValidatorIndex(ctx context.Context, publicKey [48]byte) bool

HasValidatorIndex verifies if a validator's index by public key exists in the db.

func (*Store) HasValidatorLatestVote

func (k *Store) HasValidatorLatestVote(ctx context.Context, validatorIdx uint64) bool

HasValidatorLatestVote verifies if a validator index has a latest vote stored in the db.

func (*Store) HasVoluntaryExit

func (k *Store) HasVoluntaryExit(ctx context.Context, exitRoot [32]byte) bool

HasVoluntaryExit verifies if a voluntary exit is stored in the db by its signing root.

func (*Store) HeadBlock

func (k *Store) HeadBlock(ctx context.Context) (*ethpb.BeaconBlock, error)

HeadBlock returns the latest canonical block in eth2.

func (*Store) HeadState

func (k *Store) HeadState(ctx context.Context) (*pb.BeaconState, error)

HeadState returns the latest canonical state in beacon chain.

func (*Store) IsFinalizedBlock added in v0.2.3

func (kv *Store) IsFinalizedBlock(ctx context.Context, blockRoot [32]byte) bool

IsFinalizedBlock returns true if the block root is present in the finalized block root index. A beacon block root contained exists in this index if it is considered finalized and canonical. Note: beacon blocks from the latest finalized epoch return true, whether or not they are considered canonical in the "head view" of the beacon node.

func (*Store) JustifiedCheckpoint

func (k *Store) JustifiedCheckpoint(ctx context.Context) (*ethpb.Checkpoint, error)

JustifiedCheckpoint returns the latest justified checkpoint in beacon chain.

func (*Store) ProposerSlashing

func (k *Store) ProposerSlashing(ctx context.Context, slashingRoot [32]byte) (*ethpb.ProposerSlashing, error)

ProposerSlashing retrieval by slashing root.

func (*Store) SaveArchivedActiveValidatorChanges

func (k *Store) SaveArchivedActiveValidatorChanges(ctx context.Context, epoch uint64, changes *ethpb.ArchivedActiveSetChanges) error

SaveArchivedActiveValidatorChanges by epoch.

func (*Store) SaveArchivedBalances

func (k *Store) SaveArchivedBalances(ctx context.Context, epoch uint64, balances []uint64) error

SaveArchivedBalances by epoch.

func (*Store) SaveArchivedCommitteeInfo

func (k *Store) SaveArchivedCommitteeInfo(ctx context.Context, epoch uint64, info *ethpb.ArchivedCommitteeInfo) error

SaveArchivedCommitteeInfo by epoch.

func (*Store) SaveArchivedValidatorParticipation

func (k *Store) SaveArchivedValidatorParticipation(ctx context.Context, epoch uint64, part *ethpb.ValidatorParticipation) error

SaveArchivedValidatorParticipation by epoch.

func (*Store) SaveAttestation

func (k *Store) SaveAttestation(ctx context.Context, att *ethpb.Attestation) error

SaveAttestation to the db.

func (*Store) SaveAttestations

func (k *Store) SaveAttestations(ctx context.Context, atts []*ethpb.Attestation) error

SaveAttestations via batch updates to the db.

func (*Store) SaveAttesterSlashing

func (k *Store) SaveAttesterSlashing(ctx context.Context, slashing *ethpb.AttesterSlashing) error

SaveAttesterSlashing to the db by its hash tree root.

func (*Store) SaveBlock

func (k *Store) SaveBlock(ctx context.Context, block *ethpb.BeaconBlock) error

SaveBlock to the db.

func (*Store) SaveBlocks

func (k *Store) SaveBlocks(ctx context.Context, blocks []*ethpb.BeaconBlock) error

SaveBlocks via batch updates to the db.

func (*Store) SaveDepositContractAddress

func (k *Store) SaveDepositContractAddress(ctx context.Context, addr common.Address) error

SaveDepositContractAddress to the db. It returns an error if an address has been previously saved.

func (*Store) SaveFinalizedCheckpoint

func (k *Store) SaveFinalizedCheckpoint(ctx context.Context, checkpoint *ethpb.Checkpoint) error

SaveFinalizedCheckpoint saves finalized checkpoint in beacon chain.

func (*Store) SaveGenesisBlockRoot

func (k *Store) SaveGenesisBlockRoot(ctx context.Context, blockRoot [32]byte) error

SaveGenesisBlockRoot to the db.

func (*Store) SaveHeadBlockRoot

func (k *Store) SaveHeadBlockRoot(ctx context.Context, blockRoot [32]byte) error

SaveHeadBlockRoot to the db.

func (*Store) SaveJustifiedCheckpoint

func (k *Store) SaveJustifiedCheckpoint(ctx context.Context, checkpoint *ethpb.Checkpoint) error

SaveJustifiedCheckpoint saves justified checkpoint in beacon chain.

func (*Store) SaveProposerSlashing

func (k *Store) SaveProposerSlashing(ctx context.Context, slashing *ethpb.ProposerSlashing) error

SaveProposerSlashing to the db by its hash tree root.

func (*Store) SaveState

func (k *Store) SaveState(ctx context.Context, state *pb.BeaconState, blockRoot [32]byte) error

SaveState stores a state to the db using block's signing root which was used to generate the state.

func (*Store) SaveValidatorIndex

func (k *Store) SaveValidatorIndex(ctx context.Context, publicKey [48]byte, validatorIdx uint64) error

SaveValidatorIndex by public key in the db.

func (*Store) SaveValidatorLatestVote

func (k *Store) SaveValidatorLatestVote(ctx context.Context, validatorIdx uint64, vote *pb.ValidatorLatestVote) error

SaveValidatorLatestVote by validator index.

func (*Store) SaveValidatorLatestVotes

func (k *Store) SaveValidatorLatestVotes(ctx context.Context, validatorIndices []uint64, votes []*pb.ValidatorLatestVote) error

SaveValidatorLatestVotes by validator indidces.

func (*Store) SaveVoluntaryExit

func (k *Store) SaveVoluntaryExit(ctx context.Context, exit *ethpb.VoluntaryExit) error

SaveVoluntaryExit to the db by its signing root.

func (*Store) State

func (k *Store) State(ctx context.Context, blockRoot [32]byte) (*pb.BeaconState, error)

State returns the saved state using block's signing root, this particular block was used to generate the state.

func (*Store) ValidatorIndex

func (k *Store) ValidatorIndex(ctx context.Context, publicKey [48]byte) (uint64, bool, error)

ValidatorIndex by public key.

func (*Store) ValidatorLatestVote

func (k *Store) ValidatorLatestVote(ctx context.Context, validatorIdx uint64) (*pb.ValidatorLatestVote, error)

ValidatorLatestVote retrieval by validator index.

func (*Store) VoluntaryExit

func (k *Store) VoluntaryExit(ctx context.Context, exitRoot [32]byte) (*ethpb.VoluntaryExit, error)

VoluntaryExit retrieval by signing root.

Jump to

Keyboard shortcuts

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