Skip to main content

ReliableWriter

Struct ReliableWriter 

Source
pub struct ReliableWriter { /* private fields */ }
Expand description

A reliable writer: the history and the reader proxies of a stateful writer (8.4.7, 8.4.9.2).

Implementations§

Source§

impl ReliableWriter

Source

pub fn new(guid: Guid, vendor_id: VendorId, config: WriterConfig) -> Self

A writer with an empty history and no matched readers.

Source

pub fn request_acknowledgment(&mut self)

Makes the next Self::poll ask every reader that has not acknowledged everything to answer, as for a write that waits for acknowledgments.

Source

pub fn guid(&self) -> Guid

The writer’s GUID.

Source

pub fn add_change( &mut self, inline_qos: Option<ParameterList>, payload: Option<SerializedPayload>, ) -> SequenceNumber

Adds a change to the history and returns its sequence number. It is sent to every matched reader at the next Self::poll.

Source

pub fn add_change_at( &mut self, inline_qos: Option<ParameterList>, payload: Option<SerializedPayload>, timestamp: Option<Time>, ) -> SequenceNumber

Like Self::add_change, with a source timestamp that is sent in an INFO_TS before the DATA.

Source

pub fn direct(&mut self, sn: SequenceNumber, reader: Guid)

Directs the change sn to the reader reader only: the other readers are sent a GAP for it.

Source

pub fn is_for(&self, sn: SequenceNumber, reader: &Guid) -> bool

Whether the change sn is for the reader reader: it is not directed to another one.

Source

pub fn last_sn(&self) -> SequenceNumber

The sequence number of the last change added (0 if none).

Source

pub fn len(&self) -> usize

The number of changes in the history.

Source

pub fn is_empty(&self) -> bool

Whether the history is empty.

Source

pub fn remove_oldest(&mut self) -> Option<SequenceNumber>

Removes the oldest change; returns its sequence number.

Source

pub fn remove_acknowledged(&mut self) -> usize

Removes the changes that every matched reader has acknowledged (or, for a best-effort reader, was sent), which a VOLATILE writer no longer needs (8.4.2.3.4). Returns how many were removed.

Source

pub fn remove_change(&mut self, sn: SequenceNumber) -> bool

Removes a change from the history. Readers that have not got it yet are sent a GAP instead.

Source

pub fn contains(&self, sn: SequenceNumber) -> bool

Whether the change sn is in the history.

Source

pub fn changes(&self) -> impl Iterator<Item = &Change>

The changes in the history, in order.

Source

pub fn add_reader( &mut self, guid: Guid, unicast: Vec<Locator>, multicast: Vec<Locator>, )

Matches a reliable reader (matched_reader_add). It is sent the whole history. Matching a reader again only updates its locators.

Source

pub fn add_matched_reader(&mut self, guid: Guid, m: MatchedReader)

Matches a reader (matched_reader_add), reliable or best-effort. Matching a reader again only updates its locators.

Source

pub fn steady_heartbeat_first(&mut self, reader: &Guid)

Has the HEARTBEATs to reader keep their first sequence number at the start of its range (1, or the first written after a VOLATILE match) rather than give the first change kept. A change no longer kept that the reader then asks for is answered with a GAP, so it learns of it one round trip later. For OpenDDS readers (3.31 at least), which take time proportional to the first sequence number to handle each HEARTBEAT (rustorb-dds#124).

Source

pub fn remove_reader(&mut self, guid: &Guid) -> bool

Unmatches a reader (matched_reader_remove).

Source

pub fn remove_readers_of(&mut self, prefix: &GuidPrefix)

Unmatches every reader of a participant.

Source

pub fn readers(&self) -> impl Iterator<Item = &Guid>

The matched readers.

Source

pub fn reader_destination(&self, guid: &Guid) -> Option<Vec<Locator>>

The locators a matched reader is sent to: its unicast ones, or its multicast ones if it has no unicast one.

Source

pub fn is_acked_by_all(&self, sn: SequenceNumber) -> bool

Whether every matched reader has acknowledged sn (a best-effort reader, once it was sent).

Source

pub fn is_acked_by_participant( &self, prefix: &GuidPrefix, sn: SequenceNumber, ) -> bool

Whether the matched readers of participant prefix have acknowledged sn; false if it has none.

Source

pub fn unacknowledged_octets(&self) -> usize

The octets of the changes in the history that some matched reliable reader has not acknowledged.

Source

pub fn is_all_acked(&self) -> bool

Whether every matched reliable reader has acknowledged every change written so far (what wait_for_acknowledgments waits for).

Source

pub fn handle_acknack(&mut self, reader: Guid, a: &AckNack, now: Instant)

Handles an ACKNACK from reader (8.4.9.2.8). Duplicates (a count not above the last one) and ACKNACKs from unmatched readers are ignored.

Source

pub fn handle_nackfrag(&mut self, reader: Guid, n: &NackFrag, now: Instant)

Handles a NACK_FRAG from reader (8.4.14.1): the fragments it asks for are sent again, like a repair. Duplicates and NACK_FRAGs from unmatched readers are ignored.

Source

pub fn poll(&mut self, now: Instant) -> Vec<Outgoing>

Builds what is due at now: new changes (T4), repairs (T12) and HEARTBEATs (T7).

Source

pub fn liveliness_heartbeat(&mut self) -> Vec<Outgoing>

A HEARTBEAT with the final and liveliness flags to every matched reader, reliable or not: what assert_liveliness sends for a MANUAL_BY_TOPIC writer (8.7.2.2.3). It asks for no reply.

Source

pub fn next_deadline(&self) -> Option<Instant>

When Self::poll next has something to do, if no message comes in before.

Trait Implementations§

Source§

impl Debug for ReliableWriter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for ReliableWriter

§

impl Freeze for ReliableWriter
where *const LeafNode<SequenceNumber, Change> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(SequenceNumber, Change)>>: Freeze, *const u8 is !null: Freeze, PhantomData<(Guid, ReaderProxy)>: Freeze, *const LeafNode<SequenceNumber, Guid> is !null: Freeze, PhantomData<Box<(SequenceNumber, Guid)>>: Freeze,

§

impl Move for ReliableWriter

§

impl RefUnwindSafe for ReliableWriter

§

impl Send for ReliableWriter
where NodeRef<Owned, SequenceNumber, Change, LeafOrInternal>: Send, BoxRaw<(SequenceNumber, Change)>: Send, RawTable<(Guid, ReaderProxy)>: Send, NodeRef<Owned, SequenceNumber, Guid, LeafOrInternal>: Send, BoxRaw<(SequenceNumber, Guid)>: Send,

§

impl Sync for ReliableWriter
where NodeRef<Owned, SequenceNumber, Change, LeafOrInternal>: Sync, BoxRaw<(SequenceNumber, Change)>: Sync, RawTable<(Guid, ReaderProxy)>: Sync, NodeRef<Owned, SequenceNumber, Guid, LeafOrInternal>: Sync, BoxRaw<(SequenceNumber, Guid)>: Sync,

§

impl Unpin for ReliableWriter
where *const LeafNode<SequenceNumber, Change> is !null: Unpin, Box<(SequenceNumber, Change)>: Unpin, *const u8 is !null: Unpin, *const LeafNode<SequenceNumber, SetValZST> is !null: Unpin, Box<(SequenceNumber, SetValZST)>: Unpin, *const LeafNode<SequenceNumber, BTreeSet<u32>> is !null: Unpin, Box<(SequenceNumber, BTreeSet<u32>)>: Unpin, *const LeafNode<SequenceNumber, Guid> is !null: Unpin, Box<(SequenceNumber, Guid)>: Unpin,

§

impl UnsafeUnpin for ReliableWriter

§

impl UnwindSafe for ReliableWriter

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, 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.