pub trait Helia: Send + Sync {
Show 13 methods
// Required methods
fn blockstore(&self) -> &dyn Blocks;
fn datastore(&self) -> &dyn Datastore;
fn pins(&self) -> &dyn Pins;
fn logger(&self) -> &dyn ComponentLogger;
fn routing(&self) -> &dyn Routing;
fn dns(&self) -> &TokioAsyncResolver;
fn metrics(&self) -> Option<&dyn Metrics>;
fn subscribe_events(&self) -> HeliaEventReceiver;
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), HeliaError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), HeliaError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn gc<'life0, 'async_trait>(
&'life0 self,
options: Option<GcOptions>,
) -> Pin<Box<dyn Future<Output = Result<(), HeliaError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_codec<'life0, 'async_trait>(
&'life0 self,
code: u64,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Codec>, HeliaError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_hasher<'life0, 'async_trait>(
&'life0 self,
code: u64,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Hasher>, HeliaError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Non-generic Helia trait for backward compatibility and trait objects
Required Methods§
Sourcefn blockstore(&self) -> &dyn Blocks
fn blockstore(&self) -> &dyn Blocks
The blockstore for storing blocks
Sourcefn logger(&self) -> &dyn ComponentLogger
fn logger(&self) -> &dyn ComponentLogger
The logger component
Sourcefn dns(&self) -> &TokioAsyncResolver
fn dns(&self) -> &TokioAsyncResolver
DNS resolver
Sourcefn subscribe_events(&self) -> HeliaEventReceiver
fn subscribe_events(&self) -> HeliaEventReceiver
Subscribe to events emitted by this Helia node
Returns a receiver that will receive all events emitted by the node. Multiple subscribers can listen to events simultaneously.
§Example
ⓘ
use helia_interface::{Helia, HeliaEvent};
let mut events_rx = helia.subscribe_events();
tokio::spawn(async move {
while let Ok(event) = events_rx.recv().await {
match event {
HeliaEvent::Start => println!("Helia started"),
HeliaEvent::Stop => println!("Helia stopped"),
HeliaEvent::GcStarted => println!("GC started"),
HeliaEvent::GcCompleted => println!("GC completed"),
}
}
});Sourcefn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), HeliaError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), HeliaError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start the Helia node
Sourcefn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), HeliaError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), HeliaError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stop the Helia node
Sourcefn gc<'life0, 'async_trait>(
&'life0 self,
options: Option<GcOptions>,
) -> Pin<Box<dyn Future<Output = Result<(), HeliaError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn gc<'life0, 'async_trait>(
&'life0 self,
options: Option<GcOptions>,
) -> Pin<Box<dyn Future<Output = Result<(), HeliaError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Perform garbage collection