Help us shape the future of Go! Take the 2026 Go Developer Survey

pruner

package
v0.33.35 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pruner

type Pruner struct {
	component.Component
	// contains filtered or unexported fields
}

Pruner is a component responsible for pruning data from execution data storage. It is configured with the following parameters:

  • Height range target: The target number of most recent blocks to store data for. This controls the total amount of data stored on disk.
  • Threshold: The number of block heights that we can exceed the height range target by before pruning is triggered. This controls the frequency of pruning.

The Pruner consumes a stream of tracked height notifications, and triggers pruning once the difference between the tracked height and the last pruned height reaches the height range target + threshold. A height is considered fulfilled once it has both been executed, tracked, and sealed.

func NewPruner

func NewPruner(logger zerolog.Logger, metrics module.ExecutionDataPrunerMetrics, storage tracker.Storage, opts ...PrunerOption) (*Pruner, error)

NewPruner creates a new Pruner.

func (*Pruner) NotifyFulfilledHeight

func (p *Pruner) NotifyFulfilledHeight(height uint64)

NotifyFulfilledHeight notifies the Pruner of the latest fulfilled height.

func (*Pruner) SetHeightRangeTarget

func (p *Pruner) SetHeightRangeTarget(heightRangeTarget uint64) error

SetHeightRangeTarget updates the Pruner's height range target. This may block for the duration of a pruning operation.

func (*Pruner) SetThreshold

func (p *Pruner) SetThreshold(threshold uint64) error

SetThreshold update's the Pruner's threshold. This may block for the duration of a pruning operation.

type PrunerOption

type PrunerOption func(*Pruner)

func WithHeightRangeTarget

func WithHeightRangeTarget(heightRangeTarget uint64) PrunerOption

WithHeightRangeTarget is used to configure the pruner with a custom height range target.

func WithPruneCallback

func WithPruneCallback(callback func(context.Context) error) PrunerOption

func WithThreshold

func WithThreshold(threshold uint64) PrunerOption

WithThreshold is used to configure the pruner with a custom threshold.

Jump to

Keyboard shortcuts

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