pub struct Chain { /* private fields */ }Expand description
The steps from each earlier format a session can be brought from, in the order they apply.
Implementations§
Source§impl Chain
impl Chain
Sourcepub fn migrate(
&self,
store: &dyn Store,
verify: &Verify<'_>,
) -> Result<(), SessionError>
pub fn migrate( &self, store: &dyn Store, verify: &Verify<'_>, ) -> Result<(), SessionError>
Brings the session in store to FORMAT through this chain’s
steps, when it is in an earlier format one of them starts from;
a session already in FORMAT, or with no complete log line, is
left alone.
The migrated session is checked whole before anything is written:
every record reads and its change applies, every image blob a
message names loads, and each saved value a step changed (the newest
of its key, as a read gives it, and the listed ones of META)
decodes when verify knows its type. A value no step changed is
left to the restore, which skips one that no longer decodes. Then the
session as it was is copied under KEPT and read back, and only
then is each changed file and log replaced. Logs, values and files
a step does not know are kept byte for byte.
§Errors
SessionError::Format when no step starts from the session’s
format, its logs name different formats, or a log names none;
io::ErrorKind::AlreadyExists when the store holds a kept copy
from this format already, of a migration that did not finish; a
step’s or a check’s error; or the store failing. Each but the last
is returned before anything is written. SessionError::Changed
when a log changed while it was migrated.