]> git.mxchange.org Git - quix0rs-apt-p2p.git/commitdiff
Added the new DHT interface and a bare implmentation of it.
authorCameron Dale <camrdale@gmail.com>
Mon, 17 Dec 2007 02:41:27 +0000 (18:41 -0800)
committerCameron Dale <camrdale@gmail.com>
Mon, 17 Dec 2007 02:41:27 +0000 (18:41 -0800)
apt_dht/interfaces.py [new file with mode: 0644]
apt_dht_Khashmir/DHT.py [new file with mode: 0644]

diff --git a/apt_dht/interfaces.py b/apt_dht/interfaces.py
new file mode 100644 (file)
index 0000000..c6bea9d
--- /dev/null
@@ -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 (file)
index 0000000..78d913b
--- /dev/null
@@ -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