Skip to main content

PocketIcBaselineRecipe

Trait PocketIcBaselineRecipe 

Source
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§

Source

type Metadata: Send + 'static

Metadata retained beside every baseline owned by this recipe.

Source

type Error: Error + Send + Sync + 'static

Structured caller error shared by recipe lifecycle stages.

Required Methods§

Source

fn reset_requirements(&self) -> &ResetRequirements

Reset guarantees required before an existing slot may be reused.

Source

fn build(&self) -> Result<CachedPocketIcBaseline<Self::Metadata>, Self::Error>

Construct and capture one complete baseline.

Source

fn reset_non_snapshot_state( &self, baseline: &CachedPocketIcBaseline<Self::Metadata>, ) -> Result<ResetReceipt, Self::Error>

Reset state not covered by canister snapshots.

Source

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.

Source

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.

Provided Methods§

Source

fn prepare_restore( &self, _baseline: &CachedPocketIcBaseline<Self::Metadata>, ) -> Result<(), Self::Error>

Admit recipe-specific preconditions before the pool restores snapshots.

Most recipes need no preflight. Checks such as exact current cycle-balance guards run here, before restoration can charge cycles. This cannot replace the pool’s canonical restore or manufacture its completion evidence.

Source

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".

Implementors§