pub struct StreamPressure { /* private fields */ }Expand description
Tracks protocol-level pressure counters for one application stream.
Implementations§
Source§impl StreamPressure
impl StreamPressure
Sourcepub fn new(max_in_flight: u32) -> Result<Self, ProtocolError>
pub fn new(max_in_flight: u32) -> Result<Self, ProtocolError>
Create pressure tracking for a subscription capacity declaration.
§Errors
Returns ProtocolError::CodecError when max_in_flight is zero.
Sourcepub const fn outstanding_count(&self) -> u32
pub const fn outstanding_count(&self) -> u32
Return messages delivered on this stream but not yet accepted.
Sourcepub const fn max_in_flight(&self) -> u32
pub const fn max_in_flight(&self) -> u32
Return consumer-declared in-flight capacity from the Subscribe frame.
Sourcepub const fn state(&self) -> PressureState
pub const fn state(&self) -> PressureState
Return the current pressure state for the stream.
Sourcepub fn record_delivery(
&mut self,
buffer_capacity: u32,
) -> Result<PressureState, ProtocolError>
pub fn record_delivery( &mut self, buffer_capacity: u32, ) -> Result<PressureState, ProtocolError>
Record delivery of one message and recompute state using caller capacity.
buffer_capacity is supplied by the bus/subscription layer; the protocol
state machine does not define or hardcode that threshold.
§Errors
Returns ProtocolError::CodecError when the outstanding counter or
capacity threshold overflows.
Sourcepub fn record_accept(
&mut self,
buffer_capacity: u32,
) -> Result<PressureState, ProtocolError>
pub fn record_accept( &mut self, buffer_capacity: u32, ) -> Result<PressureState, ProtocolError>
Record acceptance of one outstanding message and recompute state using caller capacity.
buffer_capacity is supplied by the bus/subscription layer; the protocol
state machine does not define or hardcode that threshold.
§Errors
Returns ProtocolError::CodecError when no messages are outstanding or
the capacity threshold overflows.