distributed_topic_tracker/gossip/
mod.rs1mod sender;
2mod receiver;
3mod topic;
4mod merge;
5
6pub use sender::GossipSender;
7pub use receiver::GossipReceiver;
8pub use topic::{Topic, TopicId, Publisher, Bootstrap};
9pub use merge::{BubbleMerge, MessageOverlapMerge};
10
11use crate::RecordPublisher;
12
13pub trait AutoDiscoveryGossip {
14 #[allow(async_fn_in_trait)]
15 async fn subscribe_and_join_with_auto_discovery(
16 &self,
17 record_publisher: RecordPublisher,
18 ) -> anyhow::Result<Topic>;
19
20 #[allow(async_fn_in_trait)]
21 async fn subscribe_and_join_with_auto_discovery_no_wait(
22 &self,
23 record_publisher: RecordPublisher,
24 ) -> anyhow::Result<Topic>;
25}
26
27impl AutoDiscoveryGossip for iroh_gossip::net::Gossip {
28 async fn subscribe_and_join_with_auto_discovery(
29 &self,
30 record_publisher: RecordPublisher,
31 ) -> anyhow::Result<Topic> {
32 Topic::new(
33 record_publisher,
34 self.clone(),
35 false,
36 )
37 .await
38 }
39
40 async fn subscribe_and_join_with_auto_discovery_no_wait(
41 &self,
42 record_publisher: RecordPublisher,
43 ) -> anyhow::Result<Topic> {
44 Topic::new(
45 record_publisher,
46 self.clone(),
47 true,
48 )
49 .await
50 }
51}