Documentation
¶
Overview ¶
Package importutil provides shared helpers for metadata import operations across all database backends (sqlite, postgres, mysql).
Index ¶
- Constants
- func BatchHydrateUtxoProvenance(db *gorm.DB, utxos []models.Utxo, chunkSize int) error
- func BatchRefetchUtxoIDs(db *gorm.DB, utxos []models.Utxo) error
- func DeactivateAccounts(db *gorm.DB, creds []models.StakeCredentialRef, chunkSize int) error
- func DeactivateDreps(db *gorm.DB, creds []models.StakeCredentialRef, chunkSize int) error
- func RetirePools(db *gorm.DB, poolKeyHashes [][]byte, epoch uint64, addedSlot uint64, ...) error
Constants ¶
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
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 ¶
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
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
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.