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

Function bounded_message_log

nodedb/src/control/pubsub.rs:415–426  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

413
414 #[test]
415 fn bounded_message_log() {
416 let registry = TopicRegistry::new(3);
417 registry.create_topic("bounded").unwrap();
418 registry.publish("bounded", "1".into(), "a").unwrap();
419 registry.publish("bounded", "2".into(), "a").unwrap();
420 registry.publish("bounded", "3".into(), "a").unwrap();
421 registry.publish("bounded", "4".into(), "a").unwrap(); // evicts "1"
422
423 let (_, _, backlog) = registry.subscribe("bounded", 1).unwrap();
424 assert_eq!(backlog.len(), 3);
425 assert_eq!(backlog[0].payload, "2");
426 }
427
428 #[test]
429 fn topic_stats_test() {

Callers

nothing calls this directly

Calls 3

create_topicMethod · 0.80
publishMethod · 0.45
subscribeMethod · 0.45

Tested by

no test coverage detected