pruner

package
v0.37.10-util-ensure-c... Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHeightRangeTarget = uint64(2_000_000)
	DefaultThreshold         = uint64(100_000)
	DefaultPruningInterval   = 10 * time.Minute
)

Variables

View Source
var ErrNoRegisteredHeightRecorders = errors.New("no registered height recorders")

ErrNoRegisteredHeightRecorders represents an error indicating that pruner did not register any execution data height recorders. This error occurs when the pruner attempts to perform operations that require at least one registered height recorder, but none are found.

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) RegisterHeightRecorder added in v0.37.1

func (p *Pruner) RegisterHeightRecorder(recorder execution_data.ProcessedHeightRecorder)

RegisterHeightRecorder registers an execution data height recorder with the Pruner.

Parameters:

  • recorder: The execution data height recorder to register.

func (*Pruner) SetHeightRangeTarget

func (p *Pruner) SetHeightRangeTarget(heightRangeTarget uint64)

SetHeightRangeTarget updates the Pruner's height range target.

func (*Pruner) SetThreshold

func (p *Pruner) SetThreshold(threshold uint64)

SetThreshold update's the Pruner's threshold.

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

WithPruneCallback sets a custom callback function to be called after pruning.

func WithPruningInterval added in v0.37.1

func WithPruningInterval(interval time.Duration) PrunerOption

WithPruningInterval is used to configure the pruner with a custom pruning interval.

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