Skip to main content

DiscoveredEndpointsCache

Struct DiscoveredEndpointsCache 

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

In-memory cache for SEDP-discovered endpoints.

Implementations§

Source§

impl DiscoveredEndpointsCache

Source

pub fn new(caps: CacheCaps) -> Self

New with the given caps.

Source

pub fn publications_len(&self) -> usize

Total number of publications.

Source

pub fn subscriptions_len(&self) -> usize

Total number of subscriptions.

Source

pub fn evicted_count(&self) -> u64

Number of LRU evictions since start (DoS diagnostics).

Source

pub fn publication(&self, key: Guid) -> Option<&DiscoveredPublication>

Looks up a publication by endpoint GUID.

Source

pub fn subscription(&self, key: Guid) -> Option<&DiscoveredSubscription>

Looks up a subscription by endpoint GUID.

Source

pub fn publications_for( &self, prefix: GuidPrefix, ) -> impl Iterator<Item = &DiscoveredPublication> + '_

Iterates all publications of a remote participant.

Source

pub fn subscriptions_for( &self, prefix: GuidPrefix, ) -> impl Iterator<Item = &DiscoveredSubscription> + '_

Iterates all subscriptions of a remote participant.

Source

pub fn publications(&self) -> impl Iterator<Item = &DiscoveredPublication> + '_

Iterates all publications (for the matching scan).

Source

pub fn subscriptions( &self, ) -> impl Iterator<Item = &DiscoveredSubscription> + '_

Iterates all subscriptions.

Source

pub fn insert_publication( &mut self, data: PublicationBuiltinTopicData, now: Duration, ) -> bool

Insert or update of a publication. Idempotent: for an already-present GUID, data is overwritten and discovered_at is updated — no eviction round.

On a new insert: if this participant’s publication count reaches the cap, the oldest publication of the same participant is discarded (LRU) and evicted_count is incremented.

Returns: true = newly inserted, false = update.

Source

pub fn insert_subscription( &mut self, data: SubscriptionBuiltinTopicData, now: Duration, ) -> bool

Insert or update of a subscription. Semantics analogous to Self::insert_publication.

Source

pub fn remove_publication(&mut self, key: Guid) -> Option<DiscoveredPublication>

Removes a publication by GUID (e.g. after an explicit withdrawal notification from the remote).

Source

pub fn remove_subscription( &mut self, key: Guid, ) -> Option<DiscoveredSubscription>

Removes a subscription by GUID.

Source

pub fn on_participant_lost(&mut self, prefix: GuidPrefix) -> (usize, usize)

Removes all publications and subscriptions of a remote participant. Called e.g. on an SPDP lease timeout.

Returns: (removed_pubs, removed_subs).

Source

pub fn match_publications<'a>( &'a self, topic: &'a str, type_name: &'a str, ) -> impl Iterator<Item = &'a DiscoveredPublication> + 'a

Finds all publications matching a (topic_name, type_name) — for reader-side matching (T4/T5).

Source

pub fn match_subscriptions<'a>( &'a self, topic: &'a str, type_name: &'a str, ) -> impl Iterator<Item = &'a DiscoveredSubscription> + 'a

Finds all subscriptions matching a (topic_name, type_name) — for writer-side matching.

Source

pub fn publication_keys(&self) -> Vec<Guid>

Collects the GUIDs of all publications (for snapshot tests / diagnostics).

Source

pub fn topic_name_conflicts(&self, topic: &str, type_name: &str) -> bool

True if any discovered publication OR subscription carries the given topic_name but a different type_name — the DDS 1.4 §2.2.4.2.4 inconsistent-topic condition (same topic, incompatible type). Used by the matching path to raise on_inconsistent_topic.

Trait Implementations§

Source§

impl Clone for DiscoveredEndpointsCache

Source§

fn clone(&self) -> DiscoveredEndpointsCache

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 DiscoveredEndpointsCache

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for DiscoveredEndpointsCache

Source§

fn default() -> DiscoveredEndpointsCache

Returns the “default value” for a type. 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.