pub struct CachedPocketIcBaselinePool<R>where
R: PocketIcBaselineRecipe,{ /* private fields */ }Expand description
Caller-owned runtime-capacity pool of independently restorable PocketIC baselines.
One pool structurally owns one PocketIcBaselineRecipe. A warm
acquisition restores the complete captured canister set, applies the
recipe’s non-snapshot reset, reaches its readiness boundary, checks typed
reset coverage, and validates final invariants before exposing a lease.
Each capacity slot owns an independent PocketIC instance.
Snapshot reuse is not a complete PocketIC rollback. The recipe must account for time, extra canisters, pending messages, subnet state, cycles, and external resources when those domains matter to its tests.
Implementations§
Source§impl<R> CachedPocketIcBaselinePool<R>where
R: PocketIcBaselineRecipe,
impl<R> CachedPocketIcBaselinePool<R>where
R: PocketIcBaselineRecipe,
Sourcepub fn new(capacity: NonZeroUsize, recipe: R) -> Self
pub fn new(capacity: NonZeroUsize, recipe: R) -> Self
Create a runtime-capacity pool that structurally owns one recipe.
Sourcepub fn recipe_id(&self) -> &FixtureRecipeId
pub fn recipe_id(&self) -> &FixtureRecipeId
Borrow the caller-owned identity of this pool’s only recipe.
Sourcepub fn capacity(&self) -> NonZeroUsize
pub fn capacity(&self) -> NonZeroUsize
Maximum number of simultaneously leased PocketIC baselines.
Sourcepub fn acquire(
&self,
) -> Result<(CachedPocketIcBaselinePoolGuard<'_, R>, BaselinePoolOutcome), BaselinePoolError<R::Error>>
pub fn acquire( &self, ) -> Result<(CachedPocketIcBaselinePoolGuard<'_, R>, BaselinePoolOutcome), BaselinePoolError<R::Error>>
Acquire one fully built or restored and validated baseline lease.
A rebuildable warm-preparation failure discards the stale slot and performs at most one build attempt. Recipe and caller panics are never converted into cache misses; the lease is invalidated while the panic continues unwinding.
§Errors
Returns a stage-specific recipe or contract error. If warm preparation and its one recovery build both fail, the error preserves both causes.