Skip to main content

migrate_block_zones_v1

Function migrate_block_zones_v1 

Source
pub fn migrate_block_zones_v1(
    mstore: &Arc<Store>,
    filestore: &Arc<FileStore>,
    data_dir: &Path,
) -> Result<MigrationStats, String>
Expand description

One-shot migration of per-block agent session zones to per-agent zones. Content-idempotent: an archive is only written when no archive for that agent already holds the same bytes, and :current is only seeded when empty — so running twice (or over a data dir that a stale MIGRATION_MARKER_V1 wrongly calls done) writes nothing twice. The framework’s db_migrations row is the gate; the marker is written at the end as evidence only.

Failure mode: per-block errors are logged + counted and do not abort the run. A get_all::<Block> failure is different — nothing was scanned — and is returned as Err so m0002::up fails the migration instead of letting the runner record it applied around a scan that never happened (codex P1 on #3070; before Phase 2 this returned default stats and up reported Ok).