Skip to main content

FaultStateStore

Trait FaultStateStore 

Source
pub trait FaultStateStore: Send + Sync {
    // Required methods
    fn reserved_ordinal(
        &self,
        key: RetryKey,
    ) -> BoxFuture<'_, Result<Option<RetryOrdinal>, FaultStateError>>;
    fn reserve(
        &self,
        reservation: RetryReservation,
    ) -> BoxFuture<'_, Result<(), FaultStateError>>;
    fn resolve(
        &self,
        key: RetryKey,
    ) -> BoxFuture<'_, Result<(), FaultStateError>>;
    fn clear_resolved(&self) -> BoxFuture<'_, Result<(), FaultStateError>>;
    fn unresolved(&self) -> BoxFuture<'_, Result<u32, FaultStateError>>;

    // Provided method
    fn bind(
        &self,
        _context: ChunkTransactionContext,
    ) -> BoxFuture<'_, Result<(), FaultStateError>> { ... }
}
Expand description

Durable, bounded retry-reservation state for one step execution.

Implementations perform a compare-and-swap: a reservation is accepted only when its ordinal directly follows the persisted ordinal for the same key. The reservation must be durable before the runtime waits for backoff.

Required Methods§

Source

fn reserved_ordinal( &self, key: RetryKey, ) -> BoxFuture<'_, Result<Option<RetryOrdinal>, FaultStateError>>

Returns the ordinal already reserved for key, when one exists.

Source

fn reserve( &self, reservation: RetryReservation, ) -> BoxFuture<'_, Result<(), FaultStateError>>

Commits one reservation, consuming its ordinal.

Source

fn resolve(&self, key: RetryKey) -> BoxFuture<'_, Result<(), FaultStateError>>

Marks key resolved because its unit of work succeeded or was skipped.

The key stays retained until the accepting chunk commits, because uncommitted work may still replay.

Source

fn clear_resolved(&self) -> BoxFuture<'_, Result<(), FaultStateError>>

Clears every resolved key in the commit that advances the checkpoint.

Source

fn unresolved(&self) -> BoxFuture<'_, Result<u32, FaultStateError>>

Returns the number of retained unresolved keys.

Provided Methods§

Source

fn bind( &self, _context: ChunkTransactionContext, ) -> BoxFuture<'_, Result<(), FaultStateError>>

Binds durable state to the step execution about to run.

The runtime calls this once before the first chunk attempt when it executes through a repository. A process-local store ignores it; a durable store cannot read or write state before it is bound.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§