coreapi: dht: simplify the implementation

License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>


This commit was moved from ipfs/interface-go-ipfs-core@22a12c2c23

This commit was moved from ipfs/boxo@78b1cf5653
This commit is contained in:
Łukasz Magiera 2018-07-19 13:18:05 +02:00 committed by Steven Allen
parent afebd69388
commit e8da394b21

View File

@ -3,21 +3,21 @@ package iface
import (
"context"
options "github.com/ipfs/go-ipfs/core/coreapi/interface/options"
"github.com/ipfs/go-ipfs/core/coreapi/interface/options"
peer "gx/ipfs/QmQsErDt8Qgw1XrsXf2BpEzDgGWtB1YLsTAARBup5b6B9W/go-libp2p-peer"
ma "gx/ipfs/QmYmsdtJ3HsodkePE3eU3TsCaP2YvPZJ4LoXnNkDE5Tpt7/go-multiaddr"
pstore "gx/ipfs/Qmda4cPRvSRyox3SqgJN6DfSZGU5TtHufPTp9uXjFj71X6/go-libp2p-peerstore"
)
// DhtAPI specifies the interface to the DHT
type DhtAPI interface {
// FindPeer queries the DHT for all of the multiaddresses associated with a
// Peer ID
FindPeer(context.Context, peer.ID) (<-chan ma.Multiaddr, error)
FindPeer(context.Context, peer.ID) (pstore.PeerInfo, error)
// FindProviders finds peers in the DHT who can provide a specific value
// given a key.
FindProviders(context.Context, Path, ...options.DhtFindProvidersOption) (<-chan peer.ID, error) //TODO: is path the right choice here?
FindProviders(context.Context, Path, ...options.DhtFindProvidersOption) (<-chan pstore.PeerInfo, error)
// WithNumProviders is an option for FindProviders which specifies the
// number of peers to look for. Default is 20