add RemoteInterfaces (foolscap schemas). some tests break.
authorBrian Warner <warner@lothar.com>
Sat, 2 Dec 2006 02:17:50 +0000 (19:17 -0700)
committerBrian Warner <warner@lothar.com>
Sat, 2 Dec 2006 02:17:50 +0000 (19:17 -0700)
allmydata/bucketstore.py
allmydata/client.py
allmydata/interfaces.py [new file with mode: 0644]
allmydata/queen.py
allmydata/storageserver.py
roadmap.txt

index 3c226dee07cee087d972ce2fe38e9a781a91364b..9ec71a9ba454284fcf013c11dbb5a45687625520 100644 (file)
@@ -4,6 +4,8 @@ from foolscap import Referenceable
 from twisted.application import service
 from twisted.python.failure import Failure
 from allmydata.util import idlib
+from zope.interface import implements
+from allmydata.interfaces import RIBucketWriter
 
 from amdlib.util.assertutil import precondition
 
@@ -44,6 +46,8 @@ class BucketStore(service.MultiService, Referenceable):
             return NoSuchBucketError()
 
 class Lease(Referenceable):
+    implements(RIBucketWriter)
+
     def __init__(self, verifierid, leaser, bucket):
         self._leaser = leaser
         self._verifierid = verifierid
index 1a25606fd52760b2a18fb775234d701c0671e968..9b8ed7ead45a8b00af860572968d9aabd1c867bb 100644 (file)
@@ -5,6 +5,8 @@ from foolscap import Tub, Referenceable
 from twisted.application import service
 from twisted.python import log
 from allmydata.util.iputil import get_local_ip_for
+from zope.interface import implements
+from allmydata.interfaces import RIClient
 
 from twisted.internet import defer, reactor
 # this BlockingResolver is because otherwise unit tests must sometimes deal
@@ -16,6 +18,7 @@ reactor.installResolver(BlockingResolver())
 from allmydata.storageserver import StorageServer
 
 class Client(service.MultiService, Referenceable):
+    implements(RIClient)
     CERTFILE = "client.pem"
     STOREDIR = 'storage'
 
diff --git a/allmydata/interfaces.py b/allmydata/interfaces.py
new file mode 100644 (file)
index 0000000..7886e0f
--- /dev/null
@@ -0,0 +1,41 @@
+
+from foolscap.schema import StringConstraint, ListOf, TupleOf, Any, Nothing
+from foolscap import RemoteInterface
+
+Nodeid = StringConstraint(20)
+PBURL = StringConstraint()
+# these three are here because Foolscap does not yet support the kind of
+# restriction I really want to apply to these.
+RIClient_ = Any
+Referenceable_ = Any
+RIBucketWriter_ = Any
+
+class RIQueenRoster(RemoteInterface):
+    def hello(nodeid=Nodeid, node=RIClient_, pburl=PBURL):
+        return Nothing
+
+class RIClient(RemoteInterface):
+    def get_service(name=str):
+        return Referenceable_
+    def add_peers(new_peers=ListOf(TupleOf(Nodeid, PBURL), maxLength=100)):
+        return Nothing
+    def lost_peers(lost_peers=ListOf(Nodeid)):
+        return Nothing
+
+class RIStorageServer(RemoteInterface):
+    def allocate_bucket(verifierid=Nodeid, bucket_num=int, size=int,
+                        leaser=Nodeid):
+        return RIBucketWriter_
+
+
+class RIBucketWriter(RemoteInterface):
+    def write(data=str):
+        return Nothing
+
+    def set_size(size=int):
+        return Nothing
+
+    def close():
+        return Nothing
+
+
index 42d10333998dfa93881bfb230f9ea334c0a4d4ac..0934b489884de50b8ce2c05292ef8138203c4874 100644 (file)
@@ -5,8 +5,12 @@ from twisted.application import service
 from twisted.python import log
 import os.path
 from allmydata.util.iputil import get_local_ip_for
+from zope.interface import implements
+from allmydata.interfaces import RIQueenRoster
 
 class Roster(service.MultiService, Referenceable):
+    implements(RIQueenRoster)
+
     def __init__(self):
         service.MultiService.__init__(self)
         self.phonebook = {}
index 34e467c4905b5bc1745361977ef1356f2d405fbb..2f8ba6eb19fc1f1df789f0dd05a50e89a2f73d4f 100644 (file)
@@ -7,11 +7,14 @@ from twisted.python.failure import Failure
 from amdlib.util.assertutil import precondition
 
 from allmydata.bucketstore import BucketStore
+from zope.interface import implements
+from allmydata.interfaces import RIStorageServer
 
 class BucketAlreadyExistsError(Exception):
     pass
 
 class StorageServer(service.MultiService, Referenceable):
+    implements(RIStorageServer)
     name = 'storageserver'
 
     def __init__(self, store_dir):
index 8701f59b54dd95e2c438e349df182b6abcdfc9ec..239b54514ca646ba59a190e603571952196b624c 100644 (file)
@@ -33,5 +33,10 @@ back pocket ideas:
  looks for differences between their self-reported availability and the
  experiences of others
 
+ store filetable URI in the first 10 peers that appear after your own nodeid
+ each entry has a sequence number, maybe a timestamp
+ on recovery, find the newest
+
 big questions:
  convergence?
+ peer list maintenance: lots of entries