pub trait SettlementOutcomeStore: Send + Sync {
// Required methods
fn settlement_store_binding(&self) -> SettlementStoreBinding;
fn claim_receipt(
&self,
receipt_id: &str,
worker_id: &str,
now_ms: u64,
lease_ms: u64,
) -> Result<Option<SettlementAttemptClaim>, SettlementRouteError>;
fn claim_due(
&self,
worker_id: &str,
now_ms: u64,
lease_ms: u64,
limit: usize,
) -> Result<Vec<SettlementAttemptClaim>, SettlementRouteError>;
fn record_claimed_outcome(
&self,
claim: &SettlementAttemptClaim,
outcome: &SettlementRoutingInput,
policy: RetryPolicy,
observed_at_ms: u64,
) -> Result<SettlementRoute, SettlementRouteError>;
}Expand description
Atomic leased store for settlement outcomes.
Required Methods§
Sourcefn settlement_store_binding(&self) -> SettlementStoreBinding
fn settlement_store_binding(&self) -> SettlementStoreBinding
Identify the durable writer that owns this outcome store.
Sourcefn claim_receipt(
&self,
receipt_id: &str,
worker_id: &str,
now_ms: u64,
lease_ms: u64,
) -> Result<Option<SettlementAttemptClaim>, SettlementRouteError>
fn claim_receipt( &self, receipt_id: &str, worker_id: &str, now_ms: u64, lease_ms: u64, ) -> Result<Option<SettlementAttemptClaim>, SettlementRouteError>
Claim one due row by receipt id, or return None when a live lease owns it.
Sourcefn claim_due(
&self,
worker_id: &str,
now_ms: u64,
lease_ms: u64,
limit: usize,
) -> Result<Vec<SettlementAttemptClaim>, SettlementRouteError>
fn claim_due( &self, worker_id: &str, now_ms: u64, lease_ms: u64, limit: usize, ) -> Result<Vec<SettlementAttemptClaim>, SettlementRouteError>
Claim a bounded due batch using the same lease and version rules.
Sourcefn record_claimed_outcome(
&self,
claim: &SettlementAttemptClaim,
outcome: &SettlementRoutingInput,
policy: RetryPolicy,
observed_at_ms: u64,
) -> Result<SettlementRoute, SettlementRouteError>
fn record_claimed_outcome( &self, claim: &SettlementAttemptClaim, outcome: &SettlementRoutingInput, policy: RetryPolicy, observed_at_ms: u64, ) -> Result<SettlementRoute, SettlementRouteError>
Atomically commit an outcome for an exact, unexpired claim.
Terminal timestamps and attempt counts come from the persisted claim, not from caller-supplied duplicates.
observed_at_ms is both the lease-validity check time and the base for
any retry visibility deadline.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".