Skip to main content

Response

Struct Response 

Source
pub struct Response<A: Application> {
Show 14 fields pub journal_persisted_wire_seq: DurableWireSeqCursor, pub policy: GatePolicy, pub replication_metrics: Option<Arc<ReplicationMetrics>>, pub replica_active: Option<[Arc<AtomicBool>; 2]>, pub heartbeat_interval: Option<Duration>, pub wait: WaitStrategy, pub utilization: Arc<StageUtilization>, pub encoder: ResponseEncoderArc<A>, pub fence_state: Arc<FenceState>, pub active_connections: Arc<AtomicU64>, pub refusals: RefusalQueue<A::Report>, pub ring_sizing: RingSizing, pub ready: Option<SyncSender<Result<()>>>, pub degraded_release: Option<DegradedRelease>,
}
Expand description

Configuration and shared state for the response stage.

Fields§

§journal_persisted_wire_seq: DurableWireSeqCursor

Highest wire seq durably persisted on this node’s journal. In the same sequence space as OutputSlot.wire_seq and the replica metrics (metrics.in_memory_sequence / metrics.acked_sequence), so the durability gate can compare these values numerically and the comparison is meaningful regardless of starting_sequence (fresh vs recovered primary). Typed DurableWireSeqCursor so the gate cannot be wired to a ring-space counter — the pre-v14 bug class. Updated by the journal stage after every fsync batch via set_last_seq_publisher.

§policy: GatePolicy

The ack policy the gate starts under and the sources of its changes — see GatePolicy.

§replication_metrics: Option<Arc<ReplicationMetrics>>

Per-slot replica cursors. None for standalone deployments (no replication wiring) — the policy then evaluates against the primary alone.

§replica_active: Option<[Arc<AtomicBool>; 2]>

Per-slot replica active flags. Only “true” slots are included in the cursor view fed to Policy::evaluate, so disconnected slots don’t pollute the view with stale zero cursors. When the resulting view is too small to satisfy a clause, the policy reports degraded and the gate stalls. Mirrors replication_metrics — None in standalone.

§heartbeat_interval: Option<Duration>§wait: WaitStrategy

How this thread waits — on an empty output ring, and inside the durability gate on the journal-disk and replication threads.

§utilization: Arc<StageUtilization>§encoder: ResponseEncoderArc<A>

Wire encoder for application-shaped payloads. The application’s encoder, constructed once at boot and shared with the DPDK response stage.

§fence_state: Arc<FenceState>

Node fencing state. When latched (a higher epoch was observed), the stage exits without the best-effort flush — in-flight responses for requests on a superseded epoch must not be acknowledged. Fencing co-sets shutdown, so the latch is only consulted on the shutdown path (zero steady-state cost). See crate::fence.

§active_connections: Arc<AtomicU64>

Live-connection count shared with the accept loop’s max_connections gate. Incremented there after auth; decremented here — the response stage owns the connection map, so “an entry left the map” is the one place a connection verifiably dies exactly once, whichever side (reader disconnect or a drop decision here) initiated it.

§refusals: RefusalQueue<A::Report>

Writes the reader refused while the node was halted. Each reply is sent once everything published before the refused request has been answered, so a client sees its replies in request order — see crate::halt.

§ring_sizing: RingSizing

Sizes the stage’s io_uring instance. A flush submits at most one SEND per dirty connection, and the connection table never holds more than --max-connections entries (the accept gate counts them), so a ring sized from that cap holds a whole flush — see RingSizing.

§ready: Option<SyncSender<Result<()>>>

Startup report: Ok once the stage holds its io_uring instance, the creation error otherwise (and the stage returns without running). The ring is created on the stage’s own thread, which is the only one allowed to submit to it, so this is how the spawner learns the outcome before it carries on. None when nobody waits for it; a creation failure is then only logged.

§degraded_release: Option<DegradedRelease>

Release of held replies on this node’s own fsync while it is halted for want of a replica; None when off. See crate::halt::DegradedRelease.

Auto Trait Implementations§

§

impl<A> !RefUnwindSafe for Response<A>

§

impl<A> !UnwindSafe for Response<A>

§

impl<A> Freeze for Response<A>
where Arc<dyn ResponseEncoder<Report = <A as Application>::Report, Query = <A as Application>::QueryResponse>>: Freeze, RefusalQueue<<A as Application>::Report>: Freeze,

§

impl<A> Send for Response<A>
where Arc<dyn ResponseEncoder<Report = <A as Application>::Report, Query = <A as Application>::QueryResponse>>: Send, RefusalQueue<<A as Application>::Report>: Send,

§

impl<A> Sync for Response<A>
where Arc<dyn ResponseEncoder<Report = <A as Application>::Report, Query = <A as Application>::QueryResponse>>: Sync, RefusalQueue<<A as Application>::Report>: Sync,

§

impl<A> Unpin for Response<A>
where Arc<dyn ResponseEncoder<Report = <A as Application>::Report, Query = <A as Application>::QueryResponse>>: Unpin, RefusalQueue<<A as Application>::Report>: Unpin,

§

impl<A> UnsafeUnpin for Response<A>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> OptionalSend for T
where T: Send + ?Sized,

Source§

impl<T> OptionalSync for T
where T: Sync + ?Sized,

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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more