importutil

package
v0.65.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package importutil provides shared helpers for metadata import operations across all database backends (sqlite, postgres, mysql).

Index

Constants

View Source
const RefetchChunkSize = 500

RefetchChunkSize limits the number of tx_ids in a single WHERE IN clause to stay within database variable limits (e.g. SQLite's SQLITE_MAX_VARIABLE_NUMBER, PostgreSQL's 65535 parameter limit).

Variables

This section is empty.

Functions

func BatchHydrateUtxoProvenance added in v0.47.1

func BatchHydrateUtxoProvenance(
	db *gorm.DB,
	utxos []models.Utxo,
	chunkSize int,
) error

BatchHydrateUtxoProvenance attaches transaction provenance to UTxOs that were inserted earlier from a ledger-state snapshot. The chain backfill later replays the producing transaction with the same tx_id/output_idx pair, but the bulk import uses ON CONFLICT DO NOTHING, so conflicted rows need this second pass to gain their transaction foreign key and real added slot.

func BatchRefetchUtxoIDs

func BatchRefetchUtxoIDs(
	db *gorm.DB,
	utxos []models.Utxo,
) error

BatchRefetchUtxoIDs resolves IDs for UTxOs whose ID was not populated by GORM after an ON CONFLICT DO NOTHING insert. It replaces per-UTxO SELECT queries with chunked batch lookups.

func DeactivateAccounts added in v0.62.0

func DeactivateAccounts(
	db *gorm.DB,
	creds []models.StakeCredentialRef,
	chunkSize int,
) error

DeactivateAccounts marks the given accounts inactive, batching updates by credential tag in IN-clause chunks of chunkSize to stay within backend bind-variable limits.

func DeactivateDreps added in v0.62.0

func DeactivateDreps(
	db *gorm.DB,
	creds []models.StakeCredentialRef,
	chunkSize int,
) error

DeactivateDreps marks the given DReps inactive, batching updates by credential tag in IN-clause chunks of chunkSize to stay within backend bind-variable limits.

func RetirePools added in v0.62.0

func RetirePools(
	db *gorm.DB,
	poolKeyHashes [][]byte,
	epoch uint64,
	addedSlot uint64,
	chunkSize int,
) error

RetirePools records a synthetic retirement (certificate_id = 0) at the given epoch for each supplied pool key hash present in the pool table. Pool key hashes with no pool row are skipped. All lookups and inserts are chunked at chunkSize to stay within backend bind-variable limits.

Pools that already carry an identical synthetic retirement (same epoch and added slot) are skipped: an interrupted catch-up retry recomputes the same stale pool set at the same tip, and pool_retirement has no unique index to reject the duplicate rows.

Types

This section is empty.

Jump to

Keyboard shortcuts

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