Skip to main content

OutgoingQueue

Struct OutgoingQueue 

Source
pub struct OutgoingQueue { /* private fields */ }
Expand description

The outgoing HTTP request queue — see the module doc.

Implementations§

Source§

impl OutgoingQueue

Source

pub fn new() -> Self

Builds an empty queue — the brand-new-device case. A shell with an existing store calls OutgoingQueue::load instead.

Source

pub fn load<S: StateStore>(store: &S) -> Result<Self, StoreError>

Rebuilds a queue from store’s durably-persisted pending requests. See the module doc’s “Restart” section for exactly what survives (enqueue order, lanes, flush epochs) and what doesn’t (in-flight status, retry backoff).

Source

pub fn discard_kind<S: StateStore>( &mut self, store: &mut S, kind: OutgoingRequestKind, ) -> Result<(), StoreError>

Drops every pending request of kind (from the queue and from store). For a kind whose request carries no side effect a restart could lose – /sync – so a core can mint a fresh one from current state instead of replaying a stale one.

Source

pub fn enqueue<S: StateStore + FlushEpoch>( &mut self, store: &mut S, request: OutgoingRequest, lane: Lane, ) -> Result<Option<FlushBatch>, StoreError>

Enqueues request on lane, persisting it via crate::store::StateStore::save_pending_request so it survives a crash before ever being acknowledged. Idempotent on request.id: enqueuing the same id twice (a duplicate dispatch) is a safe no-op the second time — Ok(None) either because nothing was pending to seal at the time, or because the id was already tracked; both cases leave this queue and store unchanged from the first call’s result, so callers never need to distinguish them.

Returns whatever FlushBatch store’s flush epoch forced open (see FlushEpoch::seal_for_request) for the caller to hand a shell — None if nothing was pending to seal.

Source

pub fn releasable<S: FlushEpoch>( &mut self, store: &S, now_ms: i64, ) -> Vec<OutgoingRequest>

Every request currently safe to send, in enqueue order: releasable means not already in flight, its lane currently has room (see the module doc’s “Lanes” table), its flush epoch is satisfied (FlushEpoch::is_released), and — for a request that has been retried before — its backoff has elapsed as of now_ms. Every returned request is marked in flight; a caller that fails to execute one must eventually call OutgoingQueue::on_transport_error (or OutgoingQueue::on_response) to release its lane again.

Source

pub fn on_response<S: StateStore>( &mut self, store: &mut S, request_id: &RequestId, response: HttpResponseDescriptor, now_ms: i64, jitter: &mut dyn Jitter, ) -> Result<Option<ResponseOutcome>, StoreError>

Feeds one HTTP response back in for request_id. Returns Ok(None) if request_id is not (or no longer) pending — a duplicate or stale response is safely ignored. See the module doc’s “Retry policy” section for the exact status-code classification.

Source

pub fn on_transport_error( &mut self, request_id: &RequestId, now_ms: i64, jitter: &mut dyn Jitter, ) -> Option<ResponseOutcome>

Feeds a transport-level failure back in (no response at all — a timeout, a connection reset, …). Always a ResponseOutcome::Retry with this queue’s own capped exponential backoff. Returns None if request_id is not (or no longer) pending.

Trait Implementations§

Source§

impl Debug for OutgoingQueue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OutgoingQueue

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V