pub struct PushReplyAwaiter { /* private fields */ }Expand description
Awaits the correlated reply to a single server-initiated push.
Returned by ConnectionSupervisor::push_to_connection. The reply slot is
resolved when the originating connection process receives a PushReply frame
carrying the same correlation id, so PushReplyAwaiter::receive blocks
(bounded) for that one correlated answer.
Implementations§
Source§impl PushReplyAwaiter
impl PushReplyAwaiter
Sourcepub const fn correlation_id(&self) -> u64
pub const fn correlation_id(&self) -> u64
Returns the correlation id this awaiter is matched on.
Sourcepub fn receive(&self, timeout: Duration) -> Result<Vec<u8>, ServerError>
pub fn receive(&self, timeout: Duration) -> Result<Vec<u8>, ServerError>
Blocks up to timeout for the client’s correlated reply payload.
timeout is a WAIT QUANTUM ONLY — a MAXIMUM wait, not a promise to
block: an elapsed poll is a benign re-arm, never a failure; the reply’s
lifetime belongs to the push. A caller may re-invoke receive
indefinitely after a ServerError::PushReplyTimeout: the reserved slot
is untouched and a later reply is still delivered byte-exact. The poll
quantum never changes the protocol outcome — for a deadlined push the
call waits no longer than the EARLIER of the caller’s quantum and the
push’s deadline, so the terminal expiry is returned promptly once due,
never held until the quantum ends and never deferred past it.
A push with no explicit deadline never touches shared supervisor state here: the elapsed quantum returns straight from the channel wait (behaviour-compatible with 0.2.3 — no registry lock, no contention, no poison exposure on the unchanged API).
§Errors
Returns ServerError::PushReplyTimeout when no reply arrived within this
timeout quantum and the push’s deadline (if any) is not yet due (a
benign re-arm — call again to keep waiting);
ServerError::PushReplyExpired when the push carried an explicit reply
deadline (via
push_to_connection_with_deadline)
and that deadline is due (terminal: the slot is removed and its §5 cap
admission released; returned as soon as the deadline passes, even
mid-quantum — but evaluated at observation points, not against the wall
clock: a reply already delivered when this call observes the slot wins
over expiry, even if it arrived after the deadline instant); or
ServerError::PushReplyDisconnected when the connection process
dropped the reply slot (the connection closed — the prompt worker-death
signal). The variants are distinct so callers classify by type, not
message.