AdaptiveNetworkNode

Trait AdaptiveNetworkNode 

Source
pub trait AdaptiveNetworkNode: Send + Sync {
    // Required methods
    fn join<'life0, 'async_trait>(
        &'life0 mut self,
        bootstrap: Vec<NodeDescriptor>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn store<'life0, 'async_trait>(
        &'life0 self,
        data: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<ContentHash>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn retrieve<'life0, 'life1, 'async_trait>(
        &'life0 self,
        hash: &'life1 ContentHash,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn publish<'life0, 'life1, 'async_trait>(
        &'life0 self,
        topic: &'life1 str,
        message: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn subscribe<'life0, 'life1, 'async_trait>(
        &'life0 self,
        topic: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Vec<u8>> + Send>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn node_info<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<NodeDescriptor>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn network_stats<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<NetworkStats>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn shutdown<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

Core trait for adaptive P2P network nodes

Required Methods§

Source

fn join<'life0, 'async_trait>( &'life0 mut self, bootstrap: Vec<NodeDescriptor>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Join the network using bootstrap nodes

Source

fn store<'life0, 'async_trait>( &'life0 self, data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<ContentHash>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Store data with adaptive replication

Source

fn retrieve<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 ContentHash, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve data using parallel strategies

Source

fn publish<'life0, 'life1, 'async_trait>( &'life0 self, topic: &'life1 str, message: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Publish a message to a gossip topic

Source

fn subscribe<'life0, 'life1, 'async_trait>( &'life0 self, topic: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Vec<u8>> + Send>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Subscribe to a gossip topic

Source

fn node_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<NodeDescriptor>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get current node information

Source

fn network_stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<NetworkStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get network statistics

Source

fn shutdown<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,

Gracefully shutdown the node

Implementors§