pub trait PendingReceiptStore: Send + Sync {
// Required methods
fn record(
&self,
receipts: Vec<PendingReceipt>,
due_at: DateTime<Utc>,
) -> PushStoreFuture<'_, Result<u64, PushStoreError>>;
fn take_due(
&self,
now: DateTime<Utc>,
retry_at: DateTime<Utc>,
limit: NonZeroU32,
) -> PushStoreFuture<'_, Result<Vec<PendingReceipt>, PushStoreError>>;
fn delete(
&self,
tickets: Vec<PushTicketId>,
) -> PushStoreFuture<'_, Result<u64, PushStoreError>>;
fn purge(
&self,
sent_before: DateTime<Utc>,
limit: NonZeroU32,
) -> PushStoreFuture<'_, Result<u64, PushStoreError>>;
fn erase_owner(
&self,
owner_id: Uuid,
) -> PushStoreFuture<'_, Result<u64, PushStoreError>>;
// Provided method
fn record_accepted(
&self,
owner_id: Uuid,
outcomes: &[PushOutcome],
sent_at: DateTime<Utc>,
) -> PushStoreFuture<'_, Result<u64, PushStoreError>> { ... }
}Expand description
Storage port for tickets whose receipts are still outstanding.
Each ticket carries a due instant. PendingReceiptStore::take_due moves
the tickets it returns to a later due instant, so concurrent pollers take
disjoint batches and a ticket that stays unsettled goes to the back of the
queue instead of blocking newer ones.
Required Methods§
Sourcefn record(
&self,
receipts: Vec<PendingReceipt>,
due_at: DateTime<Utc>,
) -> PushStoreFuture<'_, Result<u64, PushStoreError>>
fn record( &self, receipts: Vec<PendingReceipt>, due_at: DateTime<Utc>, ) -> PushStoreFuture<'_, Result<u64, PushStoreError>>
Records tickets first due at due_at; returns how many were new.
A ticket that is already recorded is left unchanged.
Sourcefn take_due(
&self,
now: DateTime<Utc>,
retry_at: DateTime<Utc>,
limit: NonZeroU32,
) -> PushStoreFuture<'_, Result<Vec<PendingReceipt>, PushStoreError>>
fn take_due( &self, now: DateTime<Utc>, retry_at: DateTime<Utc>, limit: NonZeroU32, ) -> PushStoreFuture<'_, Result<Vec<PendingReceipt>, PushStoreError>>
Takes up to limit tickets due at or before now, oldest due first,
and makes them due again at retry_at.
Sourcefn delete(
&self,
tickets: Vec<PushTicketId>,
) -> PushStoreFuture<'_, Result<u64, PushStoreError>>
fn delete( &self, tickets: Vec<PushTicketId>, ) -> PushStoreFuture<'_, Result<u64, PushStoreError>>
Deletes tickets whose receipts settled; returns how many went.
Sourcefn purge(
&self,
sent_before: DateTime<Utc>,
limit: NonZeroU32,
) -> PushStoreFuture<'_, Result<u64, PushStoreError>>
fn purge( &self, sent_before: DateTime<Utc>, limit: NonZeroU32, ) -> PushStoreFuture<'_, Result<u64, PushStoreError>>
Deletes up to limit tickets sent before sent_before; returns how many went.
Pass now - RECEIPT_RETENTION. Call it again until it returns less
than limit.
Sourcefn erase_owner(
&self,
owner_id: Uuid,
) -> PushStoreFuture<'_, Result<u64, PushStoreError>>
fn erase_owner( &self, owner_id: Uuid, ) -> PushStoreFuture<'_, Result<u64, PushStoreError>>
Deletes every ticket of one owner; returns how many went.
Provided Methods§
Sourcefn record_accepted(
&self,
owner_id: Uuid,
outcomes: &[PushOutcome],
sent_at: DateTime<Utc>,
) -> PushStoreFuture<'_, Result<u64, PushStoreError>>
fn record_accepted( &self, owner_id: Uuid, outcomes: &[PushOutcome], sent_at: DateTime<Utc>, ) -> PushStoreFuture<'_, Result<u64, PushStoreError>>
Records every PushDeliveryStatus::Accepted outcome of one send to owner_id.
Call it after PushSender::send with the
instant the send started. The tickets are first due
RECEIPT_POLL_DELAY later. Outcomes without an accepted ticket cost
no store round trip.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".