Skip to main content

QueryDelivery

Trait QueryDelivery 

Source
pub trait QueryDelivery: ConnectionExt + Sized {
Show 21 methods // Provided methods fn stream_database_id(&self) -> Result<[u8; 16], StorageError> { ... } fn rotate_stream_database_id(&self) -> Result<[u8; 16], StorageError> { ... } fn assign_delivery_sequence( &self, message_id: &[u8], ) -> Result<Option<u64>, StorageError> { ... } fn current_delivery_cursor(&self) -> Result<DeliveryCursor, StorageError> { ... } fn acquire_delivery_owner( &self, now_ns: i64, until_ns: i64, ) -> Result<DeliveryOwner, StorageError> { ... } fn acquire_delivery_owner_with_clock( &self, lease_ns: i64, clock: impl FnOnce() -> i64, ) -> Result<DeliveryOwner, StorageError> { ... } fn renew_delivery_owner( &self, owner: DeliveryOwner, now_ns: i64, until_ns: i64, ) -> Result<(), StorageError> { ... } fn renew_delivery_owner_with_clock( &self, owner: DeliveryOwner, lease_ns: i64, clock: impl FnOnce() -> i64, ) -> Result<(), StorageError> { ... } fn check_delivery_owner( &self, owner: DeliveryOwner, now_ns: i64, ) -> Result<(), StorageError> { ... } fn check_delivery_owner_with_clock( &self, owner: DeliveryOwner, clock: impl FnOnce() -> i64, ) -> Result<(), StorageError> { ... } fn release_delivery_owner( &self, owner: DeliveryOwner, ) -> Result<(), StorageError> { ... } fn delivery_message_is_retained( &self, message_id: &[u8], cursor: DeliveryCursor, now_ns: i64, ) -> Result<bool, StorageError> { ... } fn default_delivery_messages( &self, owner: DeliveryOwner, scope: &DeliveryScope, now_ns: i64, limit: u32, ) -> Result<Vec<DeliveryMessage>, StorageError> { ... } fn default_delivery_messages_bounded( &self, owner: DeliveryOwner, scope: &DeliveryScope, now_ns: i64, limit: u32, max_bytes: u64, ) -> Result<Vec<DeliveryMessage>, StorageError> { ... } fn replay_delivery_messages( &self, after: DeliveryCursor, scope: &DeliveryScope, now_ns: i64, limit: u32, ) -> Result<Vec<DeliveryMessage>, StorageError> { ... } fn replay_delivery_messages_bounded( &self, after: DeliveryCursor, scope: &DeliveryScope, now_ns: i64, limit: u32, max_bytes: u64, ) -> Result<Vec<DeliveryMessage>, StorageError> { ... } fn delivery_history_snapshot( &self, scope: &DeliveryScope, now_ns: i64, limit: u32, ) -> Result<DeliverySnapshot, StorageError> { ... } fn delivery_history_snapshot_bounded( &self, scope: &DeliveryScope, now_ns: i64, limit: u32, max_bytes: u64, ) -> Result<DeliverySnapshot, StorageError> { ... } fn delivery_history_snapshot_filtered( &self, scope: &DeliveryScope, filter: &DeliveryFilter, now_ns: i64, limit: u32, max_bytes: u64, ) -> Result<DeliverySnapshot, StorageError> { ... } fn acknowledge_delivery( &self, owner: DeliveryOwner, group_id: GroupId, cursor: DeliveryCursor, now_ns: i64, ) -> Result<(), StorageError> { ... } fn acknowledge_delivery_with_clock( &self, owner: DeliveryOwner, group_id: GroupId, cursor: DeliveryCursor, clock: impl FnOnce() -> i64, ) -> Result<(), StorageError> { ... }
}
Expand description

Local message order, retained-history reads, and fenced per-group D positions.

Provided Methods§

Source

fn stream_database_id(&self) -> Result<[u8; 16], StorageError>

Read the database identity used to reject foreign or pre-restore cursors.

Source

fn rotate_stream_database_id(&self) -> Result<[u8; 16], StorageError>

Rotate only under exclusive restore lifecycle access. Existing consumer tokens are fenced.

Source

fn assign_delivery_sequence( &self, message_id: &[u8], ) -> Result<Option<u64>, StorageError>

Allocate within the transaction that makes a message deliverable. A duplicate keeps its number. An optimistic unpublished row has no number.

Source

fn current_delivery_cursor(&self) -> Result<DeliveryCursor, StorageError>

Read the persistent allocator, not the maximum remaining message row.

Source

fn acquire_delivery_owner( &self, now_ns: i64, until_ns: i64, ) -> Result<DeliveryOwner, StorageError>

Acquire the sole default-consumer lease at a supplied time; fail if one is active.

Source

fn acquire_delivery_owner_with_clock( &self, lease_ns: i64, clock: impl FnOnce() -> i64, ) -> Result<DeliveryOwner, StorageError>

Read the clock after the writer is acquired, not before a possible lock wait.

Source

fn renew_delivery_owner( &self, owner: DeliveryOwner, now_ns: i64, until_ns: i64, ) -> Result<(), StorageError>

An expired token cannot be renewed. The caller must acquire a new token.

Source

fn renew_delivery_owner_with_clock( &self, owner: DeliveryOwner, lease_ns: i64, clock: impl FnOnce() -> i64, ) -> Result<(), StorageError>

Extend only the current, unexpired token using time read after the writer lock.

Source

fn check_delivery_owner( &self, owner: DeliveryOwner, now_ns: i64, ) -> Result<(), StorageError>

Reject expired or replaced tokens before handing a message to the app.

Source

fn check_delivery_owner_with_clock( &self, owner: DeliveryOwner, clock: impl FnOnce() -> i64, ) -> Result<(), StorageError>

Check ownership using fresh time after the database connection is available.

Source

fn release_delivery_owner( &self, owner: DeliveryOwner, ) -> Result<(), StorageError>

Release this token only; a stale consumer cannot release its replacement.

Source

fn delivery_message_is_retained( &self, message_id: &[u8], cursor: DeliveryCursor, now_ns: i64, ) -> Result<bool, StorageError>

A buffered candidate can expire or be deleted while its previous item is held.

Source

fn default_delivery_messages( &self, owner: DeliveryOwner, scope: &DeliveryScope, now_ns: i64, limit: u32, ) -> Result<Vec<DeliveryMessage>, StorageError>

Read retained candidates above each group’s default position. The caller applies consent/type filters and acknowledges scanned rows by the same owner.

Source

fn default_delivery_messages_bounded( &self, owner: DeliveryOwner, scope: &DeliveryScope, now_ns: i64, limit: u32, max_bytes: u64, ) -> Result<Vec<DeliveryMessage>, StorageError>

Bound rows and bytes before loading message bodies; this read never advances D.

Source

fn replay_delivery_messages( &self, after: DeliveryCursor, scope: &DeliveryScope, now_ns: i64, limit: u32, ) -> Result<Vec<DeliveryMessage>, StorageError>

Explicit replay does not read or write default delivery positions.

Source

fn replay_delivery_messages_bounded( &self, after: DeliveryCursor, scope: &DeliveryScope, now_ns: i64, limit: u32, max_bytes: u64, ) -> Result<Vec<DeliveryMessage>, StorageError>

Read a bounded retained prefix strictly after the cursor, without an owner or D writes.

Source

fn delivery_history_snapshot( &self, scope: &DeliveryScope, now_ns: i64, limit: u32, ) -> Result<DeliverySnapshot, StorageError>

Return recent retained history and a cursor from the same database snapshot.

Source

fn delivery_history_snapshot_bounded( &self, scope: &DeliveryScope, now_ns: i64, limit: u32, max_bytes: u64, ) -> Result<DeliverySnapshot, StorageError>

Bound history allocation while capturing its resume cursor in the same snapshot.

Source

fn delivery_history_snapshot_filtered( &self, scope: &DeliveryScope, filter: &DeliveryFilter, now_ns: i64, limit: u32, max_bytes: u64, ) -> Result<DeliverySnapshot, StorageError>

Apply history filters before its limit, with history and cursor in one read transaction.

Source

fn acknowledge_delivery( &self, owner: DeliveryOwner, group_id: GroupId, cursor: DeliveryCursor, now_ns: i64, ) -> Result<(), StorageError>

Acknowledge after callback return or the next iterator request, never on queue insertion. This also fences progress for rows excluded by a consent/type filter.

Source

fn acknowledge_delivery_with_clock( &self, owner: DeliveryOwner, group_id: GroupId, cursor: DeliveryCursor, clock: impl FnOnce() -> i64, ) -> Result<(), StorageError>

Advance this group’s D only after a fresh owner check under the state writer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§