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: 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.
policy: GatePolicyThe 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: 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. 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: RingSizingSizes 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.