pub struct TypeFollower { /* private fields */ }Expand description
Tracks which (topic, type_name) publications a monitoring tool has already
attached to, so it can attach a type-following raw reader to each newly
discovered writer type (including late joiners) exactly once.
The dedup core (TypeFollower::newly_seen) is pure — feed it the
discovered pairs and it returns only the ones not seen before — so it is
unit-testable without a live runtime. TypeFollower::poll is the
convenience that reads DcpsRuntime::discovered_publication_topics().
Implementations§
Source§impl TypeFollower
impl TypeFollower
Sourcepub fn new<I, S>(topics: I) -> Self
pub fn new<I, S>(topics: I) -> Self
Follow only the given topics. An empty iterator follows all topics.
Sourcepub fn wants_topic(&self, topic: &str) -> bool
pub fn wants_topic(&self, topic: &str) -> bool
True if this follower accepts samples for topic.
Sourcepub fn newly_seen<I, A, B>(&mut self, discovered: I) -> Vec<(String, String)>
pub fn newly_seen<I, A, B>(&mut self, discovered: I) -> Vec<(String, String)>
Pure dedup core: given the currently discovered (topic, type_name)
pairs, return those matching the topic filter that have not been seen
before, marking them seen. Order-preserving; duplicates within the input
collapse to one.