Skip to main content

ArtifactStore

Trait ArtifactStore 

Source
pub trait ArtifactStore: Send + Sync {
    // Required methods
    fn current(&self) -> UpdateResult<Option<ArtifactDescriptor>>;
    fn stage(
        &self,
        descriptor: &ArtifactDescriptor,
        bytes: &[u8],
    ) -> UpdateResult<StagedArtifact>;
    fn activate(
        &self,
        staged: StagedArtifact,
    ) -> UpdateResult<ActivationReceipt>;
    fn rollback(&self, receipt: &ActivationReceipt) -> UpdateResult<()>;
    fn commit(&self, receipt: &ActivationReceipt) -> UpdateResult<()>;

    // Provided methods
    fn recover(&self) -> UpdateResult<()> { ... }
    fn discard_staged(&self, _staged: &StagedArtifact) -> UpdateResult<()> { ... }
}
Expand description

Store contract for atomic staging and reversible activation.

Required Methods§

Source

fn current(&self) -> UpdateResult<Option<ArtifactDescriptor>>

Returns the currently active artifact.

Source

fn stage( &self, descriptor: &ArtifactDescriptor, bytes: &[u8], ) -> UpdateResult<StagedArtifact>

Persists verified bytes without changing the active artifact.

Source

fn activate(&self, staged: StagedArtifact) -> UpdateResult<ActivationReceipt>

Atomically makes a staged artifact active and returns rollback state.

Source

fn rollback(&self, receipt: &ActivationReceipt) -> UpdateResult<()>

Restores the previous artifact from an activation receipt.

Source

fn commit(&self, receipt: &ActivationReceipt) -> UpdateResult<()>

Finalizes a healthy activation and discards rollback metadata.

Provided Methods§

Source

fn recover(&self) -> UpdateResult<()>

Recovers an activation interrupted before commit.

Stores without durable activation metadata may keep the default no-op.

Source

fn discard_staged(&self, _staged: &StagedArtifact) -> UpdateResult<()>

Removes a staged artifact that failed a pre-activation smoke test.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§