dht.go 820 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

8
	peer "gx/ipfs/QmQsErDt8Qgw1XrsXf2BpEzDgGWtB1YLsTAARBup5b6B9W/go-libp2p-peer"
9
	pstore "gx/ipfs/Qmda4cPRvSRyox3SqgJN6DfSZGU5TtHufPTp9uXjFj71X6/go-libp2p-peerstore"
Łukasz Magiera's avatar
Łukasz Magiera committed
10 11 12 13 14 15
)

// DhtAPI specifies the interface to the DHT
type DhtAPI interface {
	// FindPeer queries the DHT for all of the multiaddresses associated with a
	// Peer ID
16
	FindPeer(context.Context, peer.ID) (pstore.PeerInfo, error)
Łukasz Magiera's avatar
Łukasz Magiera committed
17 18 19

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

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