consensus

package
v0.35.4 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: AGPL-3.0 Imports: 11 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCleanup

func WithCleanup(cleanup CleanupFunc) func(*Finalizer)

Types

type CleanupFunc

type CleanupFunc func(blockID flow.Identifier) error

CleanupFunc is called after a block was finalized to allow other components to execute cleanup operations.

func CleanupMempools

func CleanupMempools(
	collector module.MempoolMetrics,
	spans module.ConsensusMetrics,
	payloads storage.Payloads,
	guarantees mempool.Guarantees,
	seals mempool.IncorporatedResultSeals) CleanupFunc

func CleanupNothing

func CleanupNothing() CleanupFunc

type Finalizer

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

Finalizer is a simple wrapper around our temporary state to clean up after a block has been fully finalized to the persistent protocol state.

func NewFinalizer

func NewFinalizer(db *badger.DB,
	headers storage.Headers,
	state protocol.FollowerState,
	tracer module.Tracer,
	options ...func(*Finalizer)) *Finalizer

NewFinalizer creates a new finalizer for the temporary state.

func (*Finalizer) MakeFinal

func (f *Finalizer) MakeFinal(blockID flow.Identifier) error

MakeFinal will finalize the block with the given ID and clean up the memory pools after it.

This assumes that guarantees and seals are already in persistent state when included in a block proposal. Between entering the non-finalized chain state and being finalized, entities should be present in both the volatile memory pools and persistent storage. No errors are expected during normal operation.

Jump to

Keyboard shortcuts

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