pub trait SteppedMigrations {
// Required methods
fn len() -> u32;
fn nth_id(n: u32) -> Option<Vec<u8>>;
fn nth_max_steps(n: u32) -> Option<Option<u32>>;
fn nth_step(
n: u32,
cursor: Option<Vec<u8>>,
meter: &mut WeightMeter,
) -> Option<Result<Option<Vec<u8>>, SteppedMigrationError>>;
fn nth_transactional_step(
n: u32,
cursor: Option<Vec<u8>>,
meter: &mut WeightMeter,
) -> Option<Result<Option<Vec<u8>>, SteppedMigrationError>>;
fn nth_pre_upgrade(n: u32) -> Option<Result<Vec<u8>, TryRuntimeError>>;
fn nth_post_upgrade(
n: u32,
_state: Vec<u8>,
) -> Option<Result<(), TryRuntimeError>>;
fn cursor_max_encoded_len() -> usize;
fn identifier_max_encoded_len() -> usize;
// Provided method
fn integrity_test() -> Result<(), &'static str> { ... }
}Expand description
Multiple SteppedMigration.
Required Methods§
Sourcefn nth_id(n: u32) -> Option<Vec<u8>>
fn nth_id(n: u32) -> Option<Vec<u8>>
The nth SteppedMigration::id.
Is guaranteed to return Some if n < Self::len(). Calling this with any index larger or
equal to Self::len() MUST return None.
Sourcefn nth_max_steps(n: u32) -> Option<Option<u32>>
fn nth_max_steps(n: u32) -> Option<Option<u32>>
The SteppedMigration::max_steps of the nth migration.
Is guaranteed to return Some if n < Self::len().
Sourcefn nth_step(
n: u32,
cursor: Option<Vec<u8>>,
meter: &mut WeightMeter,
) -> Option<Result<Option<Vec<u8>>, SteppedMigrationError>>
fn nth_step( n: u32, cursor: Option<Vec<u8>>, meter: &mut WeightMeter, ) -> Option<Result<Option<Vec<u8>>, SteppedMigrationError>>
Do a SteppedMigration::step on the nth migration.
Is guaranteed to return Some if n < Self::len().
Sourcefn nth_transactional_step(
n: u32,
cursor: Option<Vec<u8>>,
meter: &mut WeightMeter,
) -> Option<Result<Option<Vec<u8>>, SteppedMigrationError>>
fn nth_transactional_step( n: u32, cursor: Option<Vec<u8>>, meter: &mut WeightMeter, ) -> Option<Result<Option<Vec<u8>>, SteppedMigrationError>>
Do a SteppedMigration::transactional_step on the nth migration.
Is guaranteed to return Some if n < Self::len().
Sourcefn nth_pre_upgrade(n: u32) -> Option<Result<Vec<u8>, TryRuntimeError>>
fn nth_pre_upgrade(n: u32) -> Option<Result<Vec<u8>, TryRuntimeError>>
Call the pre-upgrade hooks of the nth migration.
Returns None if the index is out of bounds.
Sourcefn nth_post_upgrade(
n: u32,
_state: Vec<u8>,
) -> Option<Result<(), TryRuntimeError>>
fn nth_post_upgrade( n: u32, _state: Vec<u8>, ) -> Option<Result<(), TryRuntimeError>>
Call the post-upgrade hooks of the nth migration.
Returns None if the index is out of bounds.
Sourcefn cursor_max_encoded_len() -> usize
fn cursor_max_encoded_len() -> usize
The maximal encoded length across all cursors.
Sourcefn identifier_max_encoded_len() -> usize
fn identifier_max_encoded_len() -> usize
The maximal encoded length across all identifiers.
Provided Methods§
Sourcefn integrity_test() -> Result<(), &'static str>
fn integrity_test() -> Result<(), &'static str>
Assert the integrity of the migrations.
Should be executed as part of a test prior to runtime usage. May or may not need externalities.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.