pub trait PocketIcBaselineRecipe:
Send
+ Sync
+ 'static {
type Metadata: Send + 'static;
type Error: Error + Send + Sync + 'static;
// Required methods
fn reset_requirements(&self) -> &ResetRequirements;
fn build(
&self,
) -> Result<CachedPocketIcBaseline<Self::Metadata>, Self::Error>;
fn reset_non_snapshot_state(
&self,
baseline: &CachedPocketIcBaseline<Self::Metadata>,
) -> Result<ResetReceipt, Self::Error>;
fn drive_to_readiness(
&self,
baseline: &CachedPocketIcBaseline<Self::Metadata>,
) -> Result<(), Self::Error>;
fn validate(
&self,
baseline: &CachedPocketIcBaseline<Self::Metadata>,
preparation: &PreparedBaseline,
) -> Result<(), Self::Error>;
// Provided methods
fn prepare_restore(
&self,
_baseline: &CachedPocketIcBaseline<Self::Metadata>,
) -> Result<(), Self::Error> { ... }
fn classify_failure(
&self,
stage: BaselinePreparationStage,
_error: &(dyn Error + 'static),
) -> FailureDisposition { ... }
}Expand description
Caller-owned build, preflight and non-snapshot reset policy for one pooled baseline.
Required Associated Types§
Required Methods§
Sourcefn reset_requirements(&self) -> &ResetRequirements
fn reset_requirements(&self) -> &ResetRequirements
Reset guarantees required before an existing slot may be reused.
Sourcefn build(&self) -> Result<CachedPocketIcBaseline<Self::Metadata>, Self::Error>
fn build(&self) -> Result<CachedPocketIcBaseline<Self::Metadata>, Self::Error>
Construct and capture one complete baseline. Stop/drain the complete snapshot set before capture, then start it after the complete set is captured and ready. Automatic progress stays disabled.
§Errors
Returns the recipe error if construction or baseline capture fails.
Sourcefn reset_non_snapshot_state(
&self,
baseline: &CachedPocketIcBaseline<Self::Metadata>,
) -> Result<ResetReceipt, Self::Error>
fn reset_non_snapshot_state( &self, baseline: &CachedPocketIcBaseline<Self::Metadata>, ) -> Result<ResetReceipt, Self::Error>
Reset state not covered by canister snapshots.
§Errors
Returns the recipe error if the required non-snapshot reset fails.
Sourcefn drive_to_readiness(
&self,
baseline: &CachedPocketIcBaseline<Self::Metadata>,
) -> Result<(), Self::Error>
fn drive_to_readiness( &self, baseline: &CachedPocketIcBaseline<Self::Metadata>, ) -> Result<(), Self::Error>
Drive the topology to the recipe’s readiness boundary. Successful completion permits final invariant validation. Restart the complete stopped set here, after canonical restore and the non-snapshot reset have succeeded. Never restart a partially restored set.
§Errors
Returns the recipe error if the caller-defined readiness boundary is not reached.
Sourcefn validate(
&self,
baseline: &CachedPocketIcBaseline<Self::Metadata>,
preparation: &PreparedBaseline,
) -> Result<(), Self::Error>
fn validate( &self, baseline: &CachedPocketIcBaseline<Self::Metadata>, preparation: &PreparedBaseline, ) -> Result<(), Self::Error>
Validate the same baseline invariants after build and restore. Success admits this pool-owned recipe’s baseline for leasing.
§Errors
Returns the recipe error when baseline invariants are not satisfied.
Provided Methods§
Sourcefn prepare_restore(
&self,
_baseline: &CachedPocketIcBaseline<Self::Metadata>,
) -> Result<(), Self::Error>
fn prepare_restore( &self, _baseline: &CachedPocketIcBaseline<Self::Metadata>, ) -> Result<(), Self::Error>
Admit recipe-specific preconditions before the pool restores snapshots.
Stop/drain every captured canister here unless the complete set is already stopped. Checks such as exact current cycle-balance guards also run here, before restoration can charge cycles. This cannot replace the pool’s canonical restore or manufacture its completion evidence.
§Errors
Returns the recipe error when a precondition forbids snapshot restoration.
Sourcefn classify_failure(
&self,
stage: BaselinePreparationStage,
_error: &(dyn Error + 'static),
) -> FailureDisposition
fn classify_failure( &self, stage: BaselinePreparationStage, _error: &(dyn Error + 'static), ) -> FailureDisposition
Classify a restored-slot recipe failure as fatal or rebuildable.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".