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::Lostnaming the winner — never a secondWon, 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§
Required Methods§
Sourcefn resolve(
&self,
record: &ResolutionRecord,
) -> Result<Resolution, ResolutionError<Self::Error>>
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.
Sourcefn winner(
&self,
instance: &InstanceId,
) -> Result<Option<ResponseId>, Self::Error>
fn winner( &self, instance: &InstanceId, ) -> Result<Option<ResponseId>, Self::Error>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".