Enum libp2p_kad::QueryInfo[][src]

pub enum QueryInfo {
    Bootstrap {
        peer: PeerId,
        remaining: Option<IntoIter<Key<PeerId>>>,
    },
    GetClosestPeers {
        key: Vec<u8>,
    },
    GetProviders {
        key: Key,
        providers: HashSet<PeerId>,
    },
    AddProvider {
        key: Key,
        phase: AddProviderPhase,
        context: AddProviderContext,
    },
    PutRecord {
        record: Record,
        quorum: NonZeroUsize,
        phase: PutRecordPhase,
        context: PutRecordContext,
    },
    GetRecord {
        key: Key,
        records: Vec<PeerRecord>,
        quorum: NonZeroUsize,
        cache_at: Option<Key<PeerId>>,
    },
}

Information about a running query.

Variants

Bootstrap

A query initiated by Kademlia::bootstrap.

Fields of Bootstrap

peer: PeerId

The targeted peer ID.

remaining: Option<IntoIter<Key<PeerId>>>

The remaining random peer IDs to query, one per bucket that still needs refreshing.

This is None if the initial self-lookup has not yet completed and Some with an exhausted iterator if bootstrapping is complete.

GetClosestPeers

A query initiated by Kademlia::get_closest_peers.

Fields of GetClosestPeers

key: Vec<u8>
GetProviders

A query initiated by Kademlia::get_providers.

Fields of GetProviders

key: Key

The key for which to search for providers.

providers: HashSet<PeerId>

The found providers.

AddProvider

A (repeated) query initiated by Kademlia::start_providing.

Fields of AddProvider

key: Key

The record key.

phase: AddProviderPhase

The current phase of the query.

context: AddProviderContext

The execution context of the query.

PutRecord

A (repeated) query initiated by Kademlia::put_record.

Fields of PutRecord

record: Recordquorum: NonZeroUsize

The expected quorum of responses w.r.t. the replication factor.

phase: PutRecordPhase

The current phase of the query.

context: PutRecordContext

The execution context of the query.

GetRecord

A query initiated by Kademlia::get_record.

Fields of GetRecord

key: Key

The key to look for.

records: Vec<PeerRecord>

The records with the id of the peer that returned them. None when the record was found in the local store.

quorum: NonZeroUsize

The number of records to look for.

cache_at: Option<Key<PeerId>>

The closest peer to key that did not return a record.

When a record is found in a standard Kademlia query (quorum == 1), it is cached at this peer as soon as a record is found.

Trait Implementations

impl Clone for QueryInfo[src]

impl Debug for QueryInfo[src]

Auto Trait Implementations

impl RefUnwindSafe for QueryInfo

impl Send for QueryInfo

impl Sync for QueryInfo

impl Unpin for QueryInfo

impl UnwindSafe for QueryInfo

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> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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>, 
[src]