node

package
v0.47.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const BackfillPhase = "metadata"

BackfillPhase is the phase name used for the historical metadata backfill checkpoint.

Variables

This section is empty.

Functions

func ImmutableUtxoOffsetsTipSlot added in v0.47.0

func ImmutableUtxoOffsetsTipSlot(
	db *database.Database,
) (uint64, bool, error)

ImmutableUtxoOffsetsTipSlot reports the latest slot for which the Mithril immutable-copy phase persisted produced-UTxO offset references. The second return value is false when no immutable copy has run (the sync-state key is unset); callers must treat that as "no skip threshold" and write offsets normally.

func Load added in v0.5.0

func Load(ctx context.Context, cfg *config.Config, logger *slog.Logger, immutableDir string) error

func LoadWithDB added in v0.22.0

func LoadWithDB(
	ctx context.Context,
	cfg *config.Config,
	logger *slog.Logger,
	immutableDir string,
	db *database.Database,
) error

LoadWithDB loads immutable DB blocks into the chain. If db is nil, a new database connection is opened (and closed on return).

func Run

func Run(cfg *config.Config, logger *slog.Logger) error

func RunPlannerStats added in v0.47.0

func RunPlannerStats(db *database.Database, logger *slog.Logger) error

RunPlannerStats collects query-planner statistics on the metadata store if it implements PlannerStatsUpdater. No-op for non-SQLite stores.

func WithBulkLoadPragmas added in v0.22.0

func WithBulkLoadPragmas(
	db *database.Database,
	logger *slog.Logger,
) func()

WithBulkLoadPragmas enables bulk-load optimizations on the metadata store if it implements BulkLoadOptimizer. The returned cleanup function restores normal pragmas and must be deferred by the caller.

Types

type Backfill added in v0.22.0

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

Backfill replays stored blocks to populate historical metadata. It is triggered automatically during Mithril sync when storageMode is "api".

func NewBackfill added in v0.22.0

func NewBackfill(
	db *database.Database,
	nodeCfg *cardano.CardanoNodeConfig,
	logger *slog.Logger,
) *Backfill

NewBackfill creates a new Backfill instance.

func (*Backfill) DisableNonceComputation added in v0.44.0

func (b *Backfill) DisableNonceComputation()

DisableNonceComputation skips historical block nonce reconstruction. Mithril imports already seed the ledger-state tip nonce needed for live sync; API metadata backfill does not need per-block historical nonce rows.

func (*Backfill) NeedsBackfill added in v0.22.0

func (b *Backfill) NeedsBackfill() (bool, error)

NeedsBackfill checks if there's an incomplete backfill checkpoint.

func (*Backfill) Run added in v0.22.0

func (b *Backfill) Run(ctx context.Context) error

Run executes the backfill. Blocks until complete or context cancelled. Safe to call multiple times; uses checkpoints for resume.

func (*Backfill) SetImmutableUtxoOffsetsTipSlot added in v0.47.0

func (b *Backfill) SetImmutableUtxoOffsetsTipSlot(slot uint64)

SetImmutableUtxoOffsetsTipSlot informs the backfill that produced-UTxO offset references have already been persisted by the Mithril immutable-copy phase for every block at or below the given slot. The backfill will then elide the redundant blob writes for those blocks. Passing 0 explicitly disables the optimisation (every block will write offsets even when a matching sync-state marker exists). Calls take effect at Run() entry and suppress the auto-detect from the sync-state key. Has no effect if invoked after Run has started.

type LoadBlobsOption added in v0.46.4

type LoadBlobsOption func(*loadBlobsOptions)

LoadBlobsOption customizes LoadBlobsWithDB behavior.

func WithLoadBlobsProgress added in v0.46.4

func WithLoadBlobsProgress(
	onProgress func(LoadBlobsProgress),
) LoadBlobsOption

WithLoadBlobsProgress registers a callback for blob-copy progress.

type LoadBlobsProgress added in v0.46.4

type LoadBlobsProgress struct {
	BlocksCopied    int
	CurrentSlot     uint64
	TipSlot         uint64
	BlocksPerSecond float64
	Percent         float64
}

LoadBlobsProgress reports ImmutableDB blob-copy progress.

type LoadBlobsResult added in v0.22.0

type LoadBlobsResult struct {
	BlocksCopied     int
	ImmutableTipSlot uint64
}

LoadBlobsResult contains the result of a blob-only ImmutableDB load.

func LoadBlobsWithDB added in v0.22.0

func LoadBlobsWithDB(
	ctx context.Context,
	cfg *config.Config,
	logger *slog.Logger,
	immutableDir string,
	db *database.Database,
	options ...LoadBlobsOption,
) (*LoadBlobsResult, error)

LoadBlobsWithDB copies blocks from an ImmutableDB directory into the blob store without starting the ledger processing pipeline. This is used after a Mithril snapshot import where the ledger state has already been loaded from the snapshot. Returns the number of blocks copied and the immutable tip slot so the caller can update the metadata tip to match.

Jump to

Keyboard shortcuts

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