Routing interface uses peer.PeerInfo

Providers are records that need Addresses. The routing
system needs to provide -- not only the ID, but also --
the peer's Addresses. A peer.PeerInfo is a small struct
to pass around a peer.ID and []ma.Multiaddr.
This commit is contained in:
Juan Batiz-Benet 2014-12-20 13:49:22 -08:00
parent 0b12fd65df
commit 7aca07e2be

View File

@ -16,7 +16,7 @@ var ErrNotFound = errors.New("routing: not found")
// IpfsRouting is the routing module interface
// It is implemented by things like DHTs, etc.
type IpfsRouting interface {
FindProvidersAsync(context.Context, u.Key, int) <-chan peer.Peer
FindProvidersAsync(context.Context, u.Key, int) <-chan peer.PeerInfo
// Basic Put/Get
@ -33,6 +33,7 @@ type IpfsRouting interface {
Provide(context.Context, u.Key) error
// Find specific Peer
// FindPeer searches for a peer with given ID.
FindPeer(context.Context, peer.ID) (peer.Peer, error)
// FindPeer searches for a peer with given ID, returns a peer.PeerInfo
// with relevant addresses.
FindPeer(context.Context, peer.ID) (peer.PeerInfo, error)
}