kv

package
v1.0.0-alpha.16 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2020 License: GPL-3.0 Imports: 15 Imported by: 2

Documentation

Overview

Package kv defines a persistent backend for the validator service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge(ctx context.Context, sourceStores []*Store, targetDirectory string) error

Merge merges data from sourceStores into a new store, which is created in targetDirectory.

func Split

func Split(ctx context.Context, sourceStore *Store, targetDirectory string) error

Split splits data from sourceStore into several stores, one for each public key in sourceStore. Each new store is created in its own subdirectory inside targetDirectory.

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 GetKVStore

func GetKVStore(directory string) (*Store, error)

GetKVStore returns the validator boltDB key-value store from directory. Returns nil if no such store exists.

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

func (store *Store) AttestationHistoryForPubKeys(ctx context.Context, publicKeys [][48]byte) (map[[48]byte]*slashpb.AttestationHistory, error)

AttestationHistoryForPubKeys accepts an array of validator public keys and returns a mapping of corresponding attestation history.

func (*Store) ClearDB

func (store *Store) ClearDB() error

ClearDB removes any previously stored data at the configured data directory.

func (*Store) Close

func (store *Store) Close() error

Close closes the underlying boltdb database.

func (*Store) DatabasePath

func (store *Store) DatabasePath() string

DatabasePath at which this database writes files.

func (*Store) ProposalHistoryForEpoch

func (store *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) SaveAttestationHistoryForPubKeys

func (store *Store) SaveAttestationHistoryForPubKeys(ctx context.Context, historyByPubKeys map[[48]byte]*slashpb.AttestationHistory) error

SaveAttestationHistoryForPubKeys saves the attestation histories for the requested validator public keys.

func (*Store) SaveProposalHistoryForEpoch

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

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

func (*Store) Size

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

Size returns the db size in bytes.

Jump to

Keyboard shortcuts

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