pub struct RealtimeRound { /* private fields */ }Expand description
The per-connection round state: at most one round in flight (§8.7). A
native transport creates one of these per socket and drives it from its
reader loop (route_binary) and its realtime_sync call
(begin/finish).
Implementations§
Source§impl RealtimeRound
impl RealtimeRound
pub fn new() -> Self
Sourcepub fn in_flight(&self) -> bool
pub fn in_flight(&self) -> bool
True while a round is in flight (request sent, response not yet at
END). The client-side enforcement of §8.7’s “one round in flight”.
Sourcepub fn begin(&mut self, request: &[u8]) -> Result<Vec<u8>, TransportError>
pub fn begin(&mut self, request: &[u8]) -> Result<Vec<u8>, TransportError>
Frame the request for the socket: a 0x01 tag byte followed by the
whole request envelope. Chunk boundaries are arbitrary (§8.7), so a
single chunk carrying the entire request is legal and simplest; the
request is already bounded (bulk rides segments over HTTP, §5.7), so
there is nothing to gain by splitting it. Marks the round in flight.
Returns an error if a round is already in flight (client-side §8.7 one-in-flight enforcement — the caller must not pipeline).
Sourcepub fn route_binary(
&mut self,
frame: &[u8],
) -> Result<RoundInbound, TransportError>
pub fn route_binary( &mut self, frame: &[u8], ) -> Result<RoundInbound, TransportError>
Route one inbound binary frame (tag byte + payload) while a round may
be in flight. 0x01 chunks feed the response scanner; 0x00 deltas
are surfaced for the inbound queue; unknown tags are ignored.
On a scanner error (bad envelope header) or bytes past END, the
round is failed and the error returned — the caller wakes the pending
realtime_sync with it and (per §8.7) the connection is unusable.