pub trait DeliveryClaimStore: Send + Sync {
// Required methods
fn claim(
&self,
claim: DeliveryClaim,
claimed_at: DateTime<Utc>,
) -> PushStoreFuture<'_, Result<bool, PushStoreError>>;
fn release(
&self,
claim: DeliveryClaim,
) -> PushStoreFuture<'_, Result<bool, PushStoreError>>;
fn purge(
&self,
before: NaiveDate,
limit: NonZeroU32,
) -> PushStoreFuture<'_, Result<u64, PushStoreError>>;
}Expand description
Storage port for daily delivery claims.
A scheduled sender claims before it sends, so two workers evaluating the
same owner never both deliver. If the whole send fails, it releases the
claim and a later run may try again. Event-driven senders do not need this
port. Claims grow by one row per owner, kind, and day, so schedule
DeliveryClaimStore::purge.
Required Methods§
Sourcefn claim(
&self,
claim: DeliveryClaim,
claimed_at: DateTime<Utc>,
) -> PushStoreFuture<'_, Result<bool, PushStoreError>>
fn claim( &self, claim: DeliveryClaim, claimed_at: DateTime<Utc>, ) -> PushStoreFuture<'_, Result<bool, PushStoreError>>
Records the claim; returns false when someone already holds it.
Sourcefn release(
&self,
claim: DeliveryClaim,
) -> PushStoreFuture<'_, Result<bool, PushStoreError>>
fn release( &self, claim: DeliveryClaim, ) -> PushStoreFuture<'_, Result<bool, PushStoreError>>
Drops a claim after a failed send; returns whether it existed.
Sourcefn purge(
&self,
before: NaiveDate,
limit: NonZeroU32,
) -> PushStoreFuture<'_, Result<u64, PushStoreError>>
fn purge( &self, before: NaiveDate, limit: NonZeroU32, ) -> PushStoreFuture<'_, Result<u64, PushStoreError>>
Deletes up to limit claims for local dates before before, oldest
date first; returns how many went.
Call it again until it returns less than limit.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".