Skip to main content

migrate_v1_to_v2

Function migrate_v1_to_v2 

Source
pub fn migrate_v1_to_v2(
    log_path: &Utf8Path,
    dry_run: bool,
) -> Result<MigrationReport, LogError>
Expand description

Migrate a v1 provenance log to v2 (ADR-0024).

Returns a MigrationReport describing how many rows were (or would be) rewritten and the first-row chain-anchor delta. The migration is idempotent: running it twice produces byte-equivalent output the second time.

On a missing log file, returns a no-op report (rows_rewritten = 0, first_row_v1_chain_hash = "GENESIS", first_row_v2_chain_hash = "GENESIS") — there is nothing to migrate.

§Errors

Returns LogError::Io on I/O failures and on rows that fail to parse as either v1 or v2 (the synthetic message names the line number). Returns LogError::Serialize on canonicalization failures.