statedifflength

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 17 Imported by: 1 module, 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

Overview

Package statedifflength backfills BlockCommitments.StateDiffLength for blocks stored before that field existed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Migrator

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

Migrator reads each block's state update, computes StateDiff.Length(), and rewrites the block's commitments with it. Pre-existing blocks stored 0 for the missing field, which this replaces with the real value.

Work is fanned out across reader goroutines that each fill their own write batch; a single committer drains them to disk. On a graceful shutdown the committed blocks form a contiguous range — the source emits in order and the pipeline drains everything it emitted — so the migration checkpoints the next block to resume from. After an error or crash it restarts from the oldest retained block, which is safe because re-deriving a length is idempotent.

func (*Migrator) Before

func (m *Migrator) Before(state []byte) error

Before restores the resume checkpoint from persisted intermediate state. A nil/empty state means a fresh run.

func (*Migrator) Migrate

func (m *Migrator) Migrate(
	ctx context.Context,
	database db.KeyValueStore,
	_ *networks.Network,
	logger log.StructuredLogger,
) ([]byte, error)

Jump to

Keyboard shortcuts

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