dht.go 961 Bytes
Newer Older
Łukasz Magiera's avatar
Łukasz Magiera committed
1 2 3 4 5
package iface

import (
	"context"

6
	"github.com/ipfs/go-ipfs/core/coreapi/interface/options"
Łukasz Magiera's avatar
Łukasz Magiera committed
7

Steven Allen's avatar
Steven Allen committed
8 9
	peer "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer"
	pstore "gx/ipfs/QmfAQMFpgDU2U4BXG64qVr8HSiictfWvkSBz7Y2oDj65st/go-libp2p-peerstore"
Łukasz Magiera's avatar
Łukasz Magiera committed
10 11 12
)

// DhtAPI specifies the interface to the DHT
13
// Note: This API will likely get deprecated in near future, see
14
// https://github.com/ipfs/interface-ipfs-core/issues/249 for more context.
Łukasz Magiera's avatar
Łukasz Magiera committed
15 16 17
type DhtAPI interface {
	// FindPeer queries the DHT for all of the multiaddresses associated with a
	// Peer ID
18
	FindPeer(context.Context, peer.ID) (pstore.PeerInfo, error)
Łukasz Magiera's avatar
Łukasz Magiera committed
19 20 21

	// FindProviders finds peers in the DHT who can provide a specific value
	// given a key.
22
	FindProviders(context.Context, Path, ...options.DhtFindProvidersOption) (<-chan pstore.PeerInfo, error)
Łukasz Magiera's avatar
Łukasz Magiera committed
23

Łukasz Magiera's avatar
Łukasz Magiera committed
24 25 26
	// Provide announces to the network that you are providing given values
	Provide(context.Context, Path, ...options.DhtProvideOption) error
}