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

Method unsubscribe

nodedb/src/control/pubsub.rs:323–330  ·  view source on GitHub ↗

Unsubscribe from a topic.

(&self, topic_name: &str, sub_id: u64)

Source from the content-addressed store, hash-verified

321
322 /// Unsubscribe from a topic.
323 pub fn unsubscribe(&self, topic_name: &str, sub_id: u64) {
324 let topics = super::lock_utils::read_or_recover(self.topics.read(), "topics");
325 if let Some(topic_mutex) = topics.get(topic_name) {
326 let mut topic = super::lock_utils::lock_or_recover(topic_mutex.lock(), "topic");
327 topic.subscribers.remove(&sub_id);
328 debug!(topic = topic_name, sub_id, "unsubscribed");
329 }
330 }
331
332 /// Get topic stats.
333 pub fn topic_stats(&self, topic_name: &str) -> Option<TopicStats> {

Callers

nothing calls this directly

Calls 6

read_or_recoverFunction · 0.85
lock_or_recoverFunction · 0.85
lockMethod · 0.80
readMethod · 0.45
getMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected