kinesin_rdt::stream::outbound

Struct StreamOutboundState

Source
pub struct StreamOutboundState {
    pub buffer: RingBuf<u8>,
    pub buffer_offset: u64,
    pub buffer_limit: usize,
    pub queued: RangeSet,
    pub delivered: RangeSet,
    pub message_offsets: BTreeSet<u64>,
    pub is_initial_window: bool,
    pub window_limit: u64,
    pub retransmit_strategy: RetransmitStrategy,
    pub final_offset: Option<u64>,
}
Expand description

stream outbound delivery

Fields§

§buffer: RingBuf<u8>

buffer for outbound data

§buffer_offset: u64

stream offset at which buffer starts

§buffer_limit: usize

outbound buffer size limit

§queued: RangeSet

segments queued for (re)transmission

§delivered: RangeSet

segments successfully delivered (retransmission unnecessary)

§message_offsets: BTreeSet<u64>

offsets into the stream where messages begin, if applicable

§is_initial_window: bool

if we’re still in the initial state (window limit not received yet)

§window_limit: u64

peer inbound flow control receive limit

§retransmit_strategy: RetransmitStrategy

retransmission strategy on packet loss

It is not currently supported to change this after construction.

§final_offset: Option<u64>

final length of stream (offset of final byte + 1)

Implementations§

Source§

impl StreamOutboundState

Source

pub fn new( initial_window_limit: u64, retransmit_strategy: RetransmitStrategy, ) -> StreamOutboundState

Source

pub fn writable(&self) -> u64

gets how many bytes are currently writable to the stream

Source

pub fn readable(&self) -> bool

determine whether any segment is currently sendable

Source

pub fn finished(&self) -> bool

whether stream has delivered all segments

Will return true if a final offset is set and all segments prior to that offset have been delivered. In the case of the unreliable retransmit mode, segments are considered delivered as soon as they are sent. In the deadline transmission mode, segments prior to the deadline are considered delivered even if they have not been acknowledged.

Source

pub fn update_remote_limit(&mut self, limit: u64) -> bool

remote window limit update received

Source

pub fn write_direct(&mut self, buf: &[u8]) -> Range<u64>

write segment to stream, bypassing all restrictions

Source

pub fn write_limited(&mut self, buf: &[u8]) -> usize

write segment to stream, respecting window and buffer limit

Source

pub fn finish(&mut self)

mark end of stream

Source

pub fn set_message_marker(&mut self, offset: u64)

set message marker at offset

Source

pub fn update_deadline(&mut self, new_limit: u64)

update deadline retransmission offset lower bound

Source

pub fn advance_buffer(&mut self, new_base: u64)

advance buffer, discarding data lower than the new base

Source

pub fn try_advance_buffer(&mut self)

advance buffer if necessary

Source

pub fn next_segment(&mut self, data_size_limit: usize) -> Option<Range<u64>>

get next queued segment

Source

pub fn read_segment( &self, segment: Range<u64>, ) -> Option<(RingBufSlice<'_, u8>, Option<u64>)>

get reference to bytes in segment, or none if out of range

Will return slice and first message marker in range, if one exists.

Source

pub fn segment_sent(&mut self, segment: Range<u64>)

mark segment as sent

Source

pub fn segment_lost(&mut self, segment: Range<u64>)

mark segment as lost

Source

pub fn segment_delivered(&mut self, segment: Range<u64>)

mark segment as delivered

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more