backfill

package
v3.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: GPL-3.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAdvancePastOrigin = errors.New("cannot advance backfill Status beyond the origin checkpoint slot")

Functions

This section is empty.

Types

type BackfillDB

type BackfillDB interface {
	SaveBackfillBlockRoot(ctx context.Context, blockRoot [32]byte) error
	GenesisBlockRoot(ctx context.Context) ([32]byte, error)
	OriginCheckpointBlockRoot(ctx context.Context) ([32]byte, error)
	BackfillBlockRoot(ctx context.Context) ([32]byte, error)
	Block(ctx context.Context, blockRoot [32]byte) (interfaces.SignedBeaconBlock, error)
}

BackfillDB describes the set of DB methods that the Status type needs to function.

type Status

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

Status provides a way to update and query the status of a backfill process that may be necessary to track when a node was initialized via checkpoint sync. With checkpoint sync, there will be a gap in node history from genesis until the checkpoint sync origin block. Status provides the means to update the value keeping track of the lower end of the missing block range via the Advance() method, to check whether a Slot is missing from the database via the SlotCovered() method, and to see the current StartGap() and EndGap().

func NewStatus

func NewStatus(store BackfillDB) *Status

NewStatus correctly initializes a Status value with the required database value.

func (*Status) Advance

func (s *Status) Advance(ctx context.Context, upTo types.Slot, root [32]byte) error

Advance advances the backfill position to the given slot & root. It updates the backfill block root entry in the database, and also updates the Status value's copy of the backfill position slot.

func (*Status) EndGap

func (s *Status) EndGap() types.Slot

EndGap returns the slot at the end of the range that needs to be backfilled.

func (*Status) Reload

func (s *Status) Reload(ctx context.Context) error

Reload queries the database for backfill status, initializing the internal data and validating the database state.

func (*Status) SlotCovered

func (s *Status) SlotCovered(sl types.Slot) bool

SlotCovered uses StartGap() and EndGap() to determine if the given slot is covered by the current chain history. If the slot is <= StartGap(), or >= EndGap(), the result is true. If the slot is between StartGap() and EndGap(), the result is false.

func (*Status) StartGap

func (s *Status) StartGap() types.Slot

StartGap returns the slot at the beginning of the range that needs to be backfilled.

Jump to

Keyboard shortcuts

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