Skip to main content

PocketIcSnapshotExt

Trait PocketIcSnapshotExt 

Source
pub trait PocketIcSnapshotExt {
    // Required methods
    fn capture_snapshots<I>(
        &self,
        targets: I,
    ) -> Result<ControllerSnapshots, ControllerSnapshotError>
       where I: IntoIterator<Item = CanisterSnapshotTarget>;
    fn restore_snapshots(
        &self,
        snapshots: &ControllerSnapshots,
        funding: SnapshotRestoreFunding,
    ) -> Result<(), ControllerSnapshotError>;
}
Expand description

Exact-sender capture and restore of related canister snapshots.

Required Methods§

Source

fn capture_snapshots<I>( &self, targets: I, ) -> Result<ControllerSnapshots, ControllerSnapshotError>

Capture snapshots with one explicit sender per canister.

The caller must stop and drain the complete target set before capture, then restart it only after the complete set succeeds. This helper does not stop/start canisters or rewind simulated time. Disable automatic progress and exclude concurrent instance operations throughout the set. Input is duplicate-checked before any effects and captured in deterministic canister-id order. A later failure rolls back snapshots captured earlier in the set, including known temporary transfer snapshots. No other sender is attempted after a rejection. Upload semantics preserve the captured global timer and low-memory hook alongside the module, globals, heap, stable memory, certified data and chunk store. Transfer uses bounded management messages; total work follows the captured state size.

§Errors

Returns a target-admission or snapshot-capture error, retaining completed work.

Source

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

Restore each snapshot with its exact captured sender and selected funding.

The caller must stop/drain the entire captured set before restoring and restart only after every restore and non-snapshot reset succeeds. Automatic progress and concurrent instance operations must remain disabled. Absolute timer deadlines are restored, not shifted; an expired timer may run when its canister restarts. Simulated time and lifecycle remain caller-owned.

Preserve never adds cycles; TopUpTo is evaluated before each restore. PocketIC may charge cycles for the restore itself. Rejection or panic stops the set without retrying another sender or rewinding earlier restores.

§Errors

Returns a funding or restoration error, retaining partial progress.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl PocketIcSnapshotExt for PocketIc

Implementors§