Rename project to apt-p2p.
[quix0rs-apt-p2p.git] / apt_dht / interfaces.py
1
2 """Some interfaces that are used by the apt-p2p classes."""
3
4 from zope.interface import Interface
5
6 class IDHT(Interface):
7     """An abstract interface for using a DHT implementation."""
8     
9     def loadConfig(self, config, section):
10         """Load the DHTs configuration from a dictionary.
11         
12         @type config: C{SafeConfigParser}
13         @param config: the dictionary of config values
14         """
15     
16     def join(self):
17         """Bootstrap the new DHT node into the DHT.
18         
19         @rtype: C{Deferred}
20         @return: a deferred that will fire when the node has joined
21         """
22         
23     def leave(self):
24         """Depart gracefully from the DHT.
25         
26         @rtype: C{Deferred}
27         @return: a deferred that will fire when the node has left
28         """
29         
30     def getValue(self, key):
31         """Get a value from the DHT for the specified key.
32         
33         The length of the key may be adjusted for use with the DHT.
34
35         @rtype: C{Deferred}
36         @return: a deferred that will fire with the stored values
37         """
38         
39     def storeValue(self, key, value):
40         """Store a value in the DHT for the specified key.
41
42         The length of the key may be adjusted for use with the DHT.
43         """