From: Cameron Dale Date: Mon, 17 Dec 2007 02:41:27 +0000 (-0800) Subject: Added the new DHT interface and a bare implmentation of it. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=841813702444e1f7f975e83441b0dd04015413a1;p=quix0rs-apt-p2p.git Added the new DHT interface and a bare implmentation of it. --- diff --git a/apt_dht/interfaces.py b/apt_dht/interfaces.py new file mode 100644 index 0000000..c6bea9d --- /dev/null +++ b/apt_dht/interfaces.py @@ -0,0 +1,39 @@ + +""" +Some interfaces that are used by the apt-dht classes. + +""" + +from zope.interface import Interface + +class IDHT(Interface): + """An abstract interface for using a DHT implementation.""" + + def loadConfig(self, config): + """Load the DHTs configuration from a dictionary. + + @type config: C{dictionary} + @param config: the dictionary of config values + """ + + def join(self, bootstrap_nodes): + """Bootstrap the new DHT node into the DHT. + + @type bootstrap_nodes: C{list} of (C{string}, C{int}) + @param bootstrap_nodes: a list of the nodes to contact to join the DHT + @rtype: C{Deffered} + @return: a deferred that will fire when the node has joined + """ + + def leave(self): + """Depart gracefully from the DHT. + + @rtype: C{Deffered} + @return: a deferred that will fire when the node has joined + """ + + def getValue(self, key): + """Get a value from the DHT for the specified key.""" + + def storeValue(self, key, value): + """Store a value in the DHT for the specified key.""" diff --git a/apt_dht_Khashmir/DHT.py b/apt_dht_Khashmir/DHT.py new file mode 100644 index 0000000..78d913b --- /dev/null +++ b/apt_dht_Khashmir/DHT.py @@ -0,0 +1,11 @@ + +from zope.interface import implements + +from apt_dht.interfaces import IDHT + +class DHT: + + implements(IDHT) + + def __init__(self): + pass \ No newline at end of file