Trait frame_support::migrations::SteppedMigrations
source · 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 n
th 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 n
th 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 n
th 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 n
th 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 n
th 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 n
th 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.