Move the normalization of key lengths from the HashObject to the DHT.
[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, section):
13         """Load the DHTs configuration from a dictionary.
14         
15         @type config: C{SafeConfigParser}
16         @param config: the dictionary of config values
17         """
18     
19     def join(self):
20         """Bootstrap the new DHT node into the DHT.
21         
22         @rtype: C{Deferred}
23         @return: a deferred that will fire when the node has joined
24         """
25         
26     def leave(self):
27         """Depart gracefully from the DHT.
28         
29         @rtype: C{Deferred}
30         @return: a deferred that will fire when the node has left
31         """
32         
33     def getValue(self, key):
34         """Get a value from the DHT for the specified key.
35         
36         The length of the key may be adjusted for use with the DHT.
37
38         @rtype: C{Deferred}
39         @return: a deferred that will fire with the stored values
40         """
41         
42     def storeValue(self, key, value):
43         """Store a value in the DHT for the specified key.
44
45         The length of the key may be adjusted for use with the DHT.
46         """