Skip to main content

ResolutionStore

Trait ResolutionStore 

Source
pub trait ResolutionStore {
    type Error;

    // Required methods
    fn resolve(
        &self,
        record: &ResolutionRecord,
    ) -> Result<Resolution, ResolutionError<Self::Error>>;
    fn winner(
        &self,
        instance: &InstanceId,
    ) -> Result<Option<ResponseId>, Self::Error>;
}
Expand description

Persisting the exactly-once decision.

One offer resolves at most once. Every implementation must satisfy:

  • the FIRST valid response for an offer returns Resolution::Won;
  • any later, different response returns Resolution::Lost naming the winner — never a second Won, and never a silent success;
  • the same response under the same key returns Resolution::Replayed, leaving the winner unchanged;
  • a different response under an already-used key is ResolutionError::IdempotencyConflict;
  • concurrent attempts from independent connections settle on ONE winner, and every loser observes that same winner.

Required Associated Types§

Source

type Error

The implementation’s own failure type.

Required Methods§

Source

fn resolve( &self, record: &ResolutionRecord, ) -> Result<Resolution, ResolutionError<Self::Error>>

Attempt to resolve an offer, exactly once.

§Errors

ResolutionError::IdempotencyConflict when a key is reused for a different submission, or ResolutionError::Store when the implementation itself fails.

Source

fn winner( &self, instance: &InstanceId, ) -> Result<Option<ResponseId>, Self::Error>

Who resolved this offer, if anyone has.

§Errors

The implementation’s own failure.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§