@cryptotaxi247 / kubo / commits / 8f79464eb

routing interface

Juan Batiz-Benet committed Jul 22, 2014 at 03:11 UTC 8f79464eba7b219492f02d94be8beae7204f1a12
1 file changed +33 -1
routing/routing.go
+33 -1
@@ -1,4 +1,36 @@
1 package routing
2
3 +import (
4 + "time"
5 + peer "github.com/jbenet/go-ipfs/peer"
6 + u "github.com/jbenet/go-ipfs/util"
7 +)
8
4 -// TODO SEE https://github.com/jbenet/node-ipfs/blob/master/submodules/ipfs-routing/index.js
9 +// IpfsRouting is the routing module interface
10 +// It is implemented by things like DHTs, etc.
11 +type IpfsRouting interface {
12 +
13 + // Basic Put/Get
14 +
15 + // PutValue adds value corresponding to given Key.
16 + PutValue(key u.Key, value []byte) (error)
17 +
18 + // GetValue searches for the value corresponding to given Key.
19 + GetValue(key u.Key, timeout time.Duration) ([]byte, error)
20 +
21 +
22 + // Value provider layer of indirection.
23 + // This is what DSHTs (Coral and MainlineDHT) do to store large values in a DHT.
24 +
25 + // Announce that this node can provide value for given key
26 + Provide(key u.Key) (error)
27 +
28 + // FindProviders searches for peers who can provide the value for given key.
29 + FindProviders(key u.Key, timeout time.Duration) (*peer.Peer, error)
30 +
31 +
32 + // Find specific Peer
33 +
34 + // FindPeer searches for a peer with given ID.
35 + FindPeer(id peer.ID, timeout time.Duration) (*peer.Peer, error)
36 +}