MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / topic_stats

Method topic_stats

nodedb/src/control/pubsub.rs:333–344  ·  view source on GitHub ↗

Get topic stats.

(&self, topic_name: &str)

Source from the content-addressed store, hash-verified

331
332 /// Get topic stats.
333 pub fn topic_stats(&self, topic_name: &str) -> Option<TopicStats> {
334 let topics = super::lock_utils::read_or_recover(self.topics.read(), "topics");
335 let topic_mutex = topics.get(topic_name)?;
336 let topic = super::lock_utils::lock_or_recover(topic_mutex.lock(), "topic");
337 Some(TopicStats {
338 name: topic_name.to_string(),
339 message_count: topic.messages.len(),
340 subscriber_count: topic.subscribers.len(),
341 consumer_group_count: topic.consumer_groups.len(),
342 next_seq: topic.next_seq,
343 })
344 }
345}
346
347/// Topic statistics.

Callers 3

topic_stats_testFunction · 0.80
consumer_group_statsFunction · 0.80
show_topicsFunction · 0.80

Calls 7

read_or_recoverFunction · 0.85
lock_or_recoverFunction · 0.85
lockMethod · 0.80
to_stringMethod · 0.80
readMethod · 0.45
getMethod · 0.45
lenMethod · 0.45

Tested by 2

topic_stats_testFunction · 0.64
consumer_group_statsFunction · 0.64