libp2p.routing package


libp2p.routing.interfaces module

class libp2p.routing.interfaces.IContentRouting

Bases: abc.ABC

abstract find_provider_iter(cid: bytes, count: int) → Iterable[libp2p.peer.peerinfo.PeerInfo]

Search for peers who are able to provide a given key returns an iterator of peer.PeerInfo.

abstract provide(cid: bytes, announce: bool = True) → None

Provide adds the given cid to the content routing system.

If announce is True, it also announces it, otherwise it is just kept in the local accounting of which objects are being provided.

class libp2p.routing.interfaces.IPeerRouting

Bases: abc.ABC

abstract async find_peer(peer_id: → libp2p.peer.peerinfo.PeerInfo

Find specific Peer FindPeer searches for a peer with given peer_id, returns a peer.PeerInfo with relevant addresses.

Module contents