2 """Some interfaces that are used by the apt-p2p classes."""
4 from zope.interface import Interface
7 """An abstract interface for using a DHT implementation."""
9 def loadConfig(self, config, section):
10 """Load the DHTs configuration from a dictionary.
12 @type config: C{SafeConfigParser}
13 @param config: the dictionary of config values
17 """Bootstrap the new DHT node into the DHT.
20 @return: a deferred that will fire when the node has joined
24 """Depart gracefully from the DHT.
27 @return: a deferred that will fire when the node has left
30 def getValue(self, key):
31 """Get a value from the DHT for the specified key.
33 The length of the key may be adjusted for use with the DHT.
36 @return: a deferred that will fire with the stored values
39 def storeValue(self, key, value):
40 """Store a value in the DHT for the specified key.
42 The length of the key may be adjusted for use with the DHT.
45 class IDHTStats(Interface):
46 """An abstract interface for DHTs that support statistics gathering."""
49 """Gather and format all the statistics for the DHT.
51 The statistics will be formatted for inclusion in the body
55 @return: the formatted statistics, suitable for displaying to the user
58 class IDHTStatsFactory(Interface):
59 """An abstract interface for DHTs that support statistics displaying."""
61 def getStatsFactory(self):
62 """Create and return an HTTP factory for displaying statistics.