Skip to main content

Module migration

Module migration 

Source
Expand description

Bringing a session saved in an earlier format to FORMAT: a Chain of steps, each taking the whole session (its logs and files) from one format to the next, so a change of the format adds one step. Opening a session refuses another format (SessionError::Format), and only then does a caller run Chain::migrate, so a session already in the format gets no migration pass. The chain rig ships, SHIPPED, has no step yet: every format before FORMAT was never released, so each is refused.

A migration checks the migrated session whole before it writes, keeps a copy of the session as it was under KEPT through the same store, then replaces what changed. It takes no lock: the caller holds the session, as the launcher’s lock holds a running one.

use rig_memory::{MemoryStore, migration};

let store = MemoryStore::default();
migration::SHIPPED.migrate(&store, &|_, _| Ok(()))?;

Modules§

testing
A synthetic format before FORMAT and the chain from it, for tests of migrations through a store’s own reads and writes. Rig never wrote this format, and SHIPPED has no step from it.

Structs§

Chain
The steps from each earlier format a session can be brought from, in the order they apply.

Constants§

KEPT
Where a migration keeps the session as it was, through the session’s own store: rig/kept/<format>/logs/<log>.jsonl and rig/kept/<format>/files/<file>. A migration never reads these as the session’s own files.
SHIPPED
The chain rig ships. Every change of FORMAT adds a step to it, from the format before, with a generated fixture.

Type Aliases§

Verify
Checks a saved value, by its key, as the session’s reader would read it: an error when its type is known and the value does not decode to it. A key whose type is unknown, such as one of a plugin that is not installed, is kept as it is and must pass.