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
impl ReliableWriter
Sourcepub fn new(guid: Guid, vendor_id: VendorId, config: WriterConfig) -> Self
pub fn new(guid: Guid, vendor_id: VendorId, config: WriterConfig) -> Self
A writer with an empty history and no matched readers.
Sourcepub fn add_change(
&mut self,
inline_qos: Option<ParameterList>,
payload: Option<SerializedPayload>,
) -> SequenceNumber
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.
Sourcepub fn add_change_at(
&mut self,
inline_qos: Option<ParameterList>,
payload: Option<SerializedPayload>,
timestamp: Option<Time>,
) -> SequenceNumber
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.
Sourcepub fn direct(&mut self, sn: SequenceNumber, reader: Guid)
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.
Sourcepub fn is_for(&self, sn: SequenceNumber, reader: &Guid) -> bool
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.
Sourcepub fn last_sn(&self) -> SequenceNumber
pub fn last_sn(&self) -> SequenceNumber
The sequence number of the last change added (0 if none).
Sourcepub fn remove_oldest(&mut self) -> Option<SequenceNumber>
pub fn remove_oldest(&mut self) -> Option<SequenceNumber>
Removes the oldest change; returns its sequence number.
Sourcepub fn remove_acknowledged(&mut self) -> usize
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.
Sourcepub fn remove_change(&mut self, sn: SequenceNumber) -> bool
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.
Sourcepub fn contains(&self, sn: SequenceNumber) -> bool
pub fn contains(&self, sn: SequenceNumber) -> bool
Whether the change sn is in the history.
Sourcepub fn add_reader(
&mut self,
guid: Guid,
unicast: Vec<Locator>,
multicast: Vec<Locator>,
)
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.
Sourcepub fn add_matched_reader(&mut self, guid: Guid, m: MatchedReader)
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.
Sourcepub fn remove_reader(&mut self, guid: &Guid) -> bool
pub fn remove_reader(&mut self, guid: &Guid) -> bool
Unmatches a reader (matched_reader_remove).
Sourcepub fn remove_readers_of(&mut self, prefix: &GuidPrefix)
pub fn remove_readers_of(&mut self, prefix: &GuidPrefix)
Unmatches every reader of a participant.
Sourcepub fn reader_destination(&self, guid: &Guid) -> Option<Vec<Locator>>
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.
Sourcepub fn is_acked_by_all(&self, sn: SequenceNumber) -> bool
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).
Sourcepub fn is_acked_by_participant(
&self,
prefix: &GuidPrefix,
sn: SequenceNumber,
) -> bool
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.
Sourcepub fn is_all_acked(&self) -> bool
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).
Sourcepub fn handle_acknack(&mut self, reader: Guid, a: &AckNack, now: Instant)
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.
Sourcepub fn handle_nackfrag(&mut self, reader: Guid, n: &NackFrag, now: Instant)
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.
Sourcepub fn poll(&mut self, now: Instant) -> Vec<Outgoing>
pub fn poll(&mut self, now: Instant) -> Vec<Outgoing>
Builds what is due at now: new changes (T4), repairs (T12) and
HEARTBEATs (T7).
Sourcepub fn liveliness_heartbeat(&mut self) -> Vec<Outgoing>
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.
Sourcepub fn next_deadline(&self) -> Option<Instant>
pub fn next_deadline(&self) -> Option<Instant>
When Self::poll next has something to do, if no message comes
in before.