Skip to main content

Response

Struct Response 

Source
pub struct Response<A: Application> {
    pub journal_persisted_wire_seq: DurableWireSeqCursor,
    pub ack_policy: Arc<AtomicU8>,
    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>,
}
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.

§ack_policy: Arc<AtomicU8>

Operator-selected ack policy, published through a shared AtomicU8 so the admin ACK-POLICY command can swap it at runtime without restarting the node. The response stage reads this once per gate iteration with a relaxed load (cheaper than a Mutex or refcounted Arc<Policy> snapshot) and rebuilds its local Policy when the byte changes. See crate::ack_policy::AckPolicy::as_u8 for the encoding.

§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. Constructed once at boot (Arc::new(ExchangeResponseEncoder)) 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 orders 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.

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,

§

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

§

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

§

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

§

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

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<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> 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