Trait Network

Source
pub trait Network<S: StoreParams>:
    Send
    + Sync
    + 'static {
    type Subscription: Stream<Item = NetworkEvent> + Send + Unpin;

    // Required methods
    fn local_peer_id(&self) -> &PeerId;
    fn listeners(&self, tx: Sender<Vec<Multiaddr>>);
    fn external_addresses(&self, tx: Sender<Vec<AddressRecord>>);
    fn get(&self, cid: Cid);
    fn cancel_get(&self, cid: Cid);
    fn sync(&self, cid: Cid, syncer: Arc<dyn BitswapSync>);
    fn cancel_sync(&self, cid: Cid);
    fn provide(&self, cid: Cid);
    fn unprovide(&self, cid: Cid);
    fn subscribe(&self) -> Self::Subscription;
}

Required Associated Types§

Required Methods§

Source

fn local_peer_id(&self) -> &PeerId

Source

fn listeners(&self, tx: Sender<Vec<Multiaddr>>)

Source

fn external_addresses(&self, tx: Sender<Vec<AddressRecord>>)

Source

fn get(&self, cid: Cid)

Source

fn cancel_get(&self, cid: Cid)

Source

fn sync(&self, cid: Cid, syncer: Arc<dyn BitswapSync>)

Source

fn cancel_sync(&self, cid: Cid)

Source

fn provide(&self, cid: Cid)

Source

fn unprovide(&self, cid: Cid)

Source

fn subscribe(&self) -> Self::Subscription

Implementors§