[][src]Struct libp2p_bitswap::Bitswap

pub struct Bitswap<P: StoreParams> { /* fields omitted */ }

Network behaviour that handles sending and receiving blocks.

Implementations

impl<P: StoreParams> Bitswap<P>[src]

pub fn new(config: BitswapConfig<P>) -> Self[src]

Creates a new Bitswap behaviour.

pub fn add_address(&mut self, peer_id: &PeerId, addr: Multiaddr)[src]

Adds an address for a peer.

pub fn get(&mut self, cid: Cid)[src]

Starts a get query.

pub fn cancel_get(&mut self, cid: Cid)[src]

Cancels an in progress get query.

pub fn sync(&mut self, cid: Cid, syncer: Arc<dyn BitswapSync>)[src]

Starts a sync query.

pub fn cancel_sync(&mut self, cid: Cid)[src]

Cancels an in progress sync query.

pub fn add_provider(&mut self, cid: Cid, peer_id: PeerId)[src]

Adds a provider for a cid. Used for handling the GetProviders event.

pub fn complete_get_providers(&mut self, cid: Cid)[src]

All providers where added. Used for handling the GetProviders event.

Trait Implementations

impl<P: StoreParams> NetworkBehaviour for Bitswap<P>[src]

type ProtocolsHandler = <Throttled<BitswapCodec<P>> as NetworkBehaviour>::ProtocolsHandler

Handler for all the protocols the network behaviour supports.

type OutEvent = BitswapEvent

Event generated by the NetworkBehaviour and that the swarm will report back.

Auto Trait Implementations

impl<P> !RefUnwindSafe for Bitswap<P>[src]

impl<P> Send for Bitswap<P>[src]

impl<P> Sync for Bitswap<P>[src]

impl<P> Unpin for Bitswap<P>[src]

impl<P> !UnwindSafe for Bitswap<P>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> References<RawCodec> for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,