Skip to main content

ReliableReader

Struct ReliableReader 

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

A reliable reader with 0..N writer proxies.

Implementations§

Source§

impl ReliableReader

Source

pub fn new(cfg: ReliableReaderConfig) -> Self

Creates a fresh reader.

§Panics

If cfg.assembler_caps.max_pending_sns == 0.

Source

pub fn set_best_effort(&mut self, best_effort: bool)

Marks this reader as BEST_EFFORT (true) or RELIABLE (false, the default). Best-effort readers skip leading gaps instead of waiting (see the best_effort field).

Source

pub fn guid(&self) -> Guid

GUID.

Source

pub fn writer_proxies(&self) -> &[WriterProxyState]

Read-only slice of the writer-proxy states.

Source

pub fn writer_proxy_count(&self) -> usize

Number of registered writer proxies.

Source

pub fn acknack_count(&self) -> i32

Counter of sent ACKNACKs.

Source

pub fn nackfrag_count(&self) -> i32

Counter of sent NACK_FRAGs.

Source

pub fn pending_fragment_count(&self) -> usize

Sum of the active (incomplete) fragment buffers across all proxies.

Source

pub fn dropped_fragment_count(&self) -> u64

Sum of the dropped fragments across all proxies (DoS / inconsistency diagnosis).

Source

pub fn duplicate_fragment_count(&self) -> u64

Number of DATA_FRAGs that arrived for already-known SNs (duplicate fragments, re-sends).

Source

pub fn unknown_src_count(&self) -> u64

Number of submessages whose writer_id could not be assigned to a registered proxy (misrouting / spoofing diagnosis).

Source

pub fn add_writer_proxy(&mut self, proxy: WriterProxy)

Adds a writer proxy. Idempotent: for a known GUID the reliability state (SN bounds, received cache, delivered pointer) is preserved — only the locators are refreshed.

Sets a preemptive ACKNACK as pending, so the writer gets a “hello, I’m here” ACKNACK on the next tick. Cyclone DDS responds with a HEARTBEAT and starts DATA resends — without this impulse the writer waits passively.

Important: a renewed SPDP/SEDP announce of the same writer (Cyclone re-announces periodically) must NOT discard the reader progress. A reset would, after an already-processed HEARTBEAT, produce an empty ACKNACK (“nothing missing”) → the reliable writer never delivers the DATA (cross-vendor secure-SEDP deadlock).

Source

pub fn remove_writer_proxy(&mut self, guid: Guid) -> Option<WriterProxy>

Removes a writer proxy.

Source

pub fn reset_diagnostics(&mut self)

Zeroes all diagnostic counters. Touches no state machine.

Source

pub fn handle_data( &mut self, source_prefix: GuidPrefix, data: &DataSubmessage, source_timestamp: Option<HeTimestamp>, ) -> Vec<DeliveredSample>

Process a DATA. Dispatch by writer_id to the matching proxy. Returns the reassembled samples of this proxy.

Spec §9.6.3.9 PID_STATUS_INFO: with key_flag=true + inline QoS with STATUS_INFO set, the CacheChange is marked NotAliveDisposed / NotAliveUnregistered / NotAliveDisposedUnregistered instead of Alive.

Source

pub fn handle_data_frag( &mut self, source_prefix: GuidPrefix, df: &DataFragSubmessage, now: Duration, source_timestamp: Option<HeTimestamp>, ) -> Vec<DeliveredSample>

Process a DATA_FRAG. now triggers NACK_FRAG scheduling directly, without waiting for a HEARTBEAT.

Source

pub fn handle_heartbeat( &mut self, source_prefix: GuidPrefix, hb: &HeartbeatSubmessage, now: Duration, ) -> Vec<DeliveredSample>

Process a HEARTBEAT. Dispatch by writer_id.

Source

pub fn handle_gap( &mut self, source_prefix: GuidPrefix, gap: &GapSubmessage, ) -> Vec<DeliveredSample>

Process a GAP. Dispatch by writer_id.

Source

pub fn tick(&mut self, now: Duration) -> Result<Vec<Vec<u8>>, WireError>

Tick: returns due ACKNACK/NACK_FRAG datagrams across all proxies. Per proxy its own ACKNACK/NACK_FRAG, because SN spaces are per writer.

§Errors

Wire encode error.

Source

pub fn tick_outbound( &mut self, now: Duration, ) -> Result<Vec<OutboundDatagram>, WireError>

Like Self::tick, but with target locators for each datagram. Preferred for transport integration, because each AckNack must go to the concrete writer-proxy unicast locator.

§Errors

WireError::ValueOutOfRange for an overlong submessage body.

Trait Implementations§

Source§

impl Clone for ReliableReader

Source§

fn clone(&self) -> ReliableReader

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReliableReader

Source§

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

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.