Skip to main content

Module migration

Module migration 

Source

Structs§

GenerateOptions
Options for generate.
MigrateReport
Result of an on-disk migration. Returned by migrate_file_in_place when migration ran (vs. Ok(None) when input was already current).

Constants§

CURRENT_SCHEMA_VERSION
The schema version this binary writes and expects on disk.
V1_LEGACY_KEYS
Top-level TOML keys that legacy schema versions had but V3 either removed or restructured. Suppresses “unknown key” warnings on V1/V2 configs flowing through migrate_to_current: every key here is consumed by V1Config::migrate or V2Config::migrate, so it’s expected on a stale-but-being-migrated config.

Functions§

detect_version
Detect a config’s schema version from its parsed TOML representation.
encrypt_secret_strings
Walk a TOML tree and encrypt every string leaf whose terminal key name appears in [secret_key_names]. Strings already in enc2: / enc: form are left alone (idempotent). Arrays of strings under a matching key (e.g. paired_tokens) are encrypted element-wise.
ensure_disk_at_current_version
Refuse to proceed if the on-disk config is at a stale schema version.
generate
Generate a canonical TOML config at target_version, derived by running the V1 fixture forward through the typed migration chain.
migrate_file
Pure migration from any supported version’s TOML string into the current schema version’s TOML string. Returns Ok(None) when the input is already at CURRENT_SCHEMA_VERSION.
migrate_file_in_place
File-API wrapper: read disk config, migrate, write <file>.backup adjacent to the original, then atomically replace the original. Returns Ok(None) when already current.
migrate_to_current
High-level: arbitrary versioned TOML → fully validated V3 Config. Runs migration if needed, then deserializes into the current Config type.