pruner

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: AGPL-3.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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