]> git.mxchange.org Git - quix0rs-apt-p2p.git/blob - apt_dht/interfaces.py
Added the new DHT interface and a bare implmentation of it.
[quix0rs-apt-p2p.git] / apt_dht / interfaces.py
1
2 """
3 Some interfaces that are used by the apt-dht classes.
4
5 """
6
7 from zope.interface import Interface
8
9 class IDHT(Interface):
10     """An abstract interface for using a DHT implementation."""
11     
12     def loadConfig(self, config):
13         """Load the DHTs configuration from a dictionary.
14         
15         @type config: C{dictionary}
16         @param config: the dictionary of config values
17         """
18     
19     def join(self, bootstrap_nodes):
20         """Bootstrap the new DHT node into the DHT.
21         
22         @type bootstrap_nodes: C{list} of (C{string}, C{int})
23         @param bootstrap_nodes: a list of the nodes to contact to join the DHT
24         @rtype: C{Deffered}
25         @return: a deferred that will fire when the node has joined
26         """
27         
28     def leave(self):
29         """Depart gracefully from the DHT.
30         
31         @rtype: C{Deffered}
32         @return: a deferred that will fire when the node has joined
33         """
34         
35     def getValue(self, key):
36         """Get a value from the DHT for the specified key."""
37         
38     def storeValue(self, key, value):
39         """Store a value in the DHT for the specified key."""