pub trait MigrateSequence: Sealed {
    const VERSION_RANGE: (u16, u16);

    // Required methods
    fn new(version: StorageVersion) -> Cursor;
    fn steps(
        version: StorageVersion,
        cursor: &[u8],
        weight_left: &mut Weight
    ) -> StepResult;
    fn integrity_test(max_block_weight: Weight);

    // Provided method
    fn is_upgrade_supported(
        in_storage: StorageVersion,
        target: StorageVersion
    ) -> bool { ... }
}
Expand description

Defines a sequence of migrations.

The sequence must be defined by a tuple of migrations, each of which must implement the MigrationStep trait. Migrations must be ordered by their versions with no gaps.

Required Associated Constants§

source

const VERSION_RANGE: (u16, u16)

Returns the range of versions that this migrations sequence can handle. Migrations must be ordered by their versions with no gaps.

The following code will fail to compile:

	let _ = <(NoopMigration<1>, NoopMigration<3>)>::VERSION_RANGE;

The following code will compile:

	let _ = <(NoopMigration<1>, NoopMigration<2>)>::VERSION_RANGE;

Required Methods§

source

fn new(version: StorageVersion) -> Cursor

Returns the default cursor for the given version.

source

fn steps( version: StorageVersion, cursor: &[u8], weight_left: &mut Weight ) -> StepResult

Execute the migration step until the weight limit is reached.

source

fn integrity_test(max_block_weight: Weight)

Verify that the migration step fits into Cursor, and that max_step_weight is not greater than max_block_weight.

Provided Methods§

source

fn is_upgrade_supported( in_storage: StorageVersion, target: StorageVersion ) -> bool

Returns whether migrating from in_storage to target is supported.

A migration is supported if VERSION_RANGE is (in_storage + 1, target).

Implementations on Foreign Types§

source§

impl<TupleElement0: MigrationStep> MigrateSequence for (TupleElement0,)

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], weight_left: &mut Weight ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep, TupleElement3: MigrationStep, TupleElement4: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4)

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], weight_left: &mut Weight ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep, TupleElement3: MigrationStep, TupleElement4: MigrationStep, TupleElement5: MigrationStep, TupleElement6: MigrationStep, TupleElement7: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7)

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], weight_left: &mut Weight ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep, TupleElement3: MigrationStep, TupleElement4: MigrationStep, TupleElement5: MigrationStep, TupleElement6: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6)

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], weight_left: &mut Weight ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep, TupleElement3: MigrationStep, TupleElement4: MigrationStep, TupleElement5: MigrationStep, TupleElement6: MigrationStep, TupleElement7: MigrationStep, TupleElement8: MigrationStep, TupleElement9: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9)

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], weight_left: &mut Weight ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep, TupleElement3: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2, TupleElement3)

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], weight_left: &mut Weight ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep, TupleElement3: MigrationStep, TupleElement4: MigrationStep, TupleElement5: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5)

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], weight_left: &mut Weight ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2)

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], weight_left: &mut Weight ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1)

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], weight_left: &mut Weight ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl MigrateSequence for ()

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], weight_left: &mut Weight ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

source§

impl<TupleElement0: MigrationStep, TupleElement1: MigrationStep, TupleElement2: MigrationStep, TupleElement3: MigrationStep, TupleElement4: MigrationStep, TupleElement5: MigrationStep, TupleElement6: MigrationStep, TupleElement7: MigrationStep, TupleElement8: MigrationStep> MigrateSequence for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8)

source§

const VERSION_RANGE: (u16, u16) = _

source§

fn new(version: StorageVersion) -> Cursor

source§

fn steps( version: StorageVersion, cursor: &[u8], weight_left: &mut Weight ) -> StepResult

source§

fn integrity_test(max_block_weight: Weight)

Implementors§