Skip to main content

SessionMigrator

Trait SessionMigrator 

Source
pub trait SessionMigrator: Send + Sync {
    // Required methods
    fn source_version(&self) -> u32;
    fn target_version(&self) -> u32;
    fn migrate(
        &self,
        meta: &SessionMeta,
        entries: Vec<SessionEntry>,
    ) -> Result<Vec<SessionEntry>>;
}
Expand description

Migrates session entries from one schema version to the next.

Implementations should transform entries from source_version() to target_version(). The migration runner calls migrate only when the session’s version matches source_version().

Required Methods§

Source

fn source_version(&self) -> u32

The schema version this migrator reads.

Source

fn target_version(&self) -> u32

The schema version this migrator produces.

Source

fn migrate( &self, meta: &SessionMeta, entries: Vec<SessionEntry>, ) -> Result<Vec<SessionEntry>>

Transform session entries from source_version to target_version.

The implementation may modify, add, or remove entries. It must NOT modify meta.version — the runner handles that.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§