pub struct CachedPocketIcBaseline<T> { /* private fields */ }Expand description
One owned PocketIC instance with captured snapshots and caller metadata.
The value contains no global synchronization. Callers choose the specific
Mutex slot passed to restore_or_rebuild_cached_pocket_ic_baseline.
Implementations§
Source§impl<T> CachedPocketIcBaseline<T>
impl<T> CachedPocketIcBaseline<T>
Sourcepub fn capture<I>(
pocket_ic: PocketIc,
controller_id: Principal,
canister_ids: I,
metadata: T,
) -> Result<Self, ControllerSnapshotError>where
I: IntoIterator<Item = Principal>,
pub fn capture<I>(
pocket_ic: PocketIc,
controller_id: Principal,
canister_ids: I,
metadata: T,
) -> Result<Self, ControllerSnapshotError>where
I: IntoIterator<Item = Principal>,
Capture one cached baseline from the current PocketIC instance.
Snapshot capture is ordered and transactional as documented by
PocketIcSnapshotExt::capture_controller_snapshots.
Sourcepub fn capture_with_senders<I>(
pocket_ic: PocketIc,
targets: I,
metadata: T,
) -> Result<Self, ControllerSnapshotError>where
I: IntoIterator<Item = CanisterSnapshotTarget>,
pub fn capture_with_senders<I>(
pocket_ic: PocketIc,
targets: I,
metadata: T,
) -> Result<Self, ControllerSnapshotError>where
I: IntoIterator<Item = CanisterSnapshotTarget>,
Capture one cached baseline with an explicit sender for every canister.
This avoids fallback rejections in mixed-controller topologies.
Sourcepub fn restore(
&self,
controller_id: Principal,
) -> Result<(), ControllerSnapshotError>
pub fn restore( &self, controller_id: Principal, ) -> Result<(), ControllerSnapshotError>
Restore the captured snapshot set without adding cycles.
Sourcepub fn restore_with_funding(
&self,
controller_id: Principal,
funding: SnapshotRestoreFunding,
) -> Result<(), ControllerSnapshotError>
pub fn restore_with_funding( &self, controller_id: Principal, funding: SnapshotRestoreFunding, ) -> Result<(), ControllerSnapshotError>
Restore the captured snapshot set with an explicit cycle-funding policy.
Sourcepub fn restore_with_captured_senders(
&self,
) -> Result<(), ControllerSnapshotError>
pub fn restore_with_captured_senders( &self, ) -> Result<(), ControllerSnapshotError>
Restore with exactly the senders retained during snapshot capture.
Sourcepub fn restore_with_captured_senders_and_funding(
&self,
funding: SnapshotRestoreFunding,
) -> Result<(), ControllerSnapshotError>
pub fn restore_with_captured_senders_and_funding( &self, funding: SnapshotRestoreFunding, ) -> Result<(), ControllerSnapshotError>
Restore with captured senders and an explicit cycle-funding policy.
Sourcepub const fn pocket_ic(&self) -> &PocketIc
pub const fn pocket_ic(&self) -> &PocketIc
Borrow the owned PocketIC instance behind this cached baseline.
Sourcepub fn snapshot_count(&self) -> usize
pub fn snapshot_count(&self) -> usize
Return the number of canisters captured by this baseline.
Sourcepub fn snapshot_canister_ids(&self) -> impl Iterator<Item = Principal> + '_
pub fn snapshot_canister_ids(&self) -> impl Iterator<Item = Principal> + '_
Iterate over captured canister ids in deterministic principal order.
Sourcepub const fn metadata(&self) -> &T
pub const fn metadata(&self) -> &T
Borrow the captured metadata associated with this cached baseline.
Sourcepub const fn metadata_mut(&mut self) -> &mut T
pub const fn metadata_mut(&mut self) -> &mut T
Mutably borrow the captured metadata associated with this cached baseline.