Documentation
¶
Index ¶
- Constants
- func ImmutableUtxoOffsetsTipSlot(db *database.Database) (uint64, bool, error)
- func Load(ctx context.Context, cfg *config.Config, logger *slog.Logger, ...) error
- func LoadWithDB(ctx context.Context, cfg *config.Config, logger *slog.Logger, ...) error
- func Run(cfg *config.Config, logger *slog.Logger) error
- func RunPlannerStats(db *database.Database, logger *slog.Logger) error
- func WithBulkLoadPragmas(db *database.Database, logger *slog.Logger) func()
- type Backfill
- type LoadBlobsOption
- type LoadBlobsProgress
- type LoadBlobsResult
Constants ¶
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
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 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 RunPlannerStats ¶ added in v0.47.0
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
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
NeedsBackfill checks if there's an incomplete backfill checkpoint.
func (*Backfill) Run ¶ added in v0.22.0
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
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
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.