Skip to main content

PocketIcSnapshotExt

Trait PocketIcSnapshotExt 

Source
pub trait PocketIcSnapshotExt {
    // Required methods
    fn capture_controller_snapshots<I>(
        &self,
        controller_id: Principal,
        canister_ids: I,
    ) -> Result<ControllerSnapshots, ControllerSnapshotError>
       where I: IntoIterator<Item = Principal>;
    fn restore_controller_snapshots(
        &self,
        controller_id: Principal,
        snapshots: &ControllerSnapshots,
    ) -> Result<(), ControllerSnapshotError>;
    fn restore_controller_snapshots_with_funding(
        &self,
        controller_id: Principal,
        snapshots: &ControllerSnapshots,
        funding: SnapshotRestoreFunding,
    ) -> Result<(), ControllerSnapshotError>;
}
Expand description

Controller-aware capture and restore of related canister snapshots.

Required Methods§

Source

fn capture_controller_snapshots<I>( &self, controller_id: Principal, canister_ids: I, ) -> Result<ControllerSnapshots, ControllerSnapshotError>
where I: IntoIterator<Item = Principal>,

Capture one restorable snapshot per unique canister.

Input is validated before capture begins. If a later capture fails, snapshots already captured by this operation are deleted before the structured error is returned.

Source

fn restore_controller_snapshots( &self, controller_id: Principal, snapshots: &ControllerSnapshots, ) -> Result<(), ControllerSnapshotError>

Restore a previously captured snapshot set using the same controller.

This default path never funds the canister before restore. PocketIC may still charge cycles as part of the restore operation itself.

Source

fn restore_controller_snapshots_with_funding( &self, controller_id: Principal, snapshots: &ControllerSnapshots, funding: SnapshotRestoreFunding, ) -> Result<(), ControllerSnapshotError>

Restore a snapshot set with an explicit cycle-funding policy.

TopUpTo is evaluated immediately before each restore attempt. No cycles are removed when the current balance already meets the minimum.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§