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>,
pub refusals: RefusalQueue<A::Report>,
}Expand description
Configuration and shared state for the response stage.
Fields§
§journal_persisted_wire_seq: DurableWireSeqCursorHighest 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: WaitStrategyHow 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.
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.