Skip to main content

hashtree_network/
local_bus.rs

1use anyhow::Result;
2use async_trait::async_trait;
3use nostr_sdk::nostr::Event;
4use std::sync::Arc;
5use std::time::Duration;
6
7use crate::root_events::PeerRootEvent;
8
9#[async_trait]
10pub trait LocalNostrBus: Send + Sync {
11    fn source_name(&self) -> &'static str;
12
13    async fn broadcast_event(&self, event: &Event) -> Result<()>;
14
15    async fn query_root(
16        &self,
17        owner_pubkey: &str,
18        tree_name: &str,
19        timeout: Duration,
20    ) -> Option<PeerRootEvent>;
21}
22
23pub type SharedLocalNostrBus = Arc<dyn LocalNostrBus>;