pub trait RelayPoolTrait: Send + Sync {
// Required methods
fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
relay_urls: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn publish_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 Event,
) -> Pin<Box<dyn Future<Output = Result<EventId>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn publish<'life0, 'async_trait>(
&'life0 self,
builder: EventBuilder,
) -> Pin<Box<dyn Future<Output = Result<EventId>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn sign<'life0, 'async_trait>(
&'life0 self,
builder: EventBuilder,
) -> Pin<Box<dyn Future<Output = Result<Event>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn signer<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn NostrSigner>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn notifications(&self) -> Receiver<RelayPoolNotification>;
fn public_key<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PublicKey>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn subscribe<'life0, 'async_trait>(
&'life0 self,
filters: Vec<Filter>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait abstracting relay pool operations, enabling dependency injection and testing.
Required Methods§
Sourcefn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
relay_urls: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
relay_urls: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Connect to the given relay URLs.
Sourcefn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Disconnect from all relays.
Sourcefn publish_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 Event,
) -> Pin<Box<dyn Future<Output = Result<EventId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn publish_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 Event,
) -> Pin<Box<dyn Future<Output = Result<EventId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Publish a pre-built event to relays.
Sourcefn publish<'life0, 'async_trait>(
&'life0 self,
builder: EventBuilder,
) -> Pin<Box<dyn Future<Output = Result<EventId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn publish<'life0, 'async_trait>(
&'life0 self,
builder: EventBuilder,
) -> Pin<Box<dyn Future<Output = Result<EventId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Build, sign, and publish an event from a builder.
Sourcefn sign<'life0, 'async_trait>(
&'life0 self,
builder: EventBuilder,
) -> Pin<Box<dyn Future<Output = Result<Event>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn sign<'life0, 'async_trait>(
&'life0 self,
builder: EventBuilder,
) -> Pin<Box<dyn Future<Output = Result<Event>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sign an event builder without publishing.
Sourcefn signer<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn NostrSigner>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn signer<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn NostrSigner>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the signer associated with this relay pool.
Sourcefn notifications(&self) -> Receiver<RelayPoolNotification>
fn notifications(&self) -> Receiver<RelayPoolNotification>
Get notifications receiver for event streaming.