From: Brian Warner Date: Sat, 2 Dec 2006 02:17:50 +0000 (-0700) Subject: add RemoteInterfaces (foolscap schemas). some tests break. X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~499 X-Git-Url: https://git.rkrishnan.org/specifications/components/com_hotproperty/%22doc.html?a=commitdiff_plain;h=e9d67ecc493218b6e4ea598c24013c7a440ab6d0;p=tahoe-lafs%2Ftahoe-lafs.git add RemoteInterfaces (foolscap schemas). some tests break. --- diff --git a/allmydata/bucketstore.py b/allmydata/bucketstore.py index 3c226dee..9ec71a9b 100644 --- a/allmydata/bucketstore.py +++ b/allmydata/bucketstore.py @@ -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 diff --git a/allmydata/client.py b/allmydata/client.py index 1a25606f..9b8ed7ea 100644 --- a/allmydata/client.py +++ b/allmydata/client.py @@ -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 index 00000000..7886e0fb --- /dev/null +++ b/allmydata/interfaces.py @@ -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 + + diff --git a/allmydata/queen.py b/allmydata/queen.py index 42d10333..0934b489 100644 --- a/allmydata/queen.py +++ b/allmydata/queen.py @@ -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 = {} diff --git a/allmydata/storageserver.py b/allmydata/storageserver.py index 34e467c4..2f8ba6eb 100644 --- a/allmydata/storageserver.py +++ b/allmydata/storageserver.py @@ -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): diff --git a/roadmap.txt b/roadmap.txt index 8701f59b..239b5451 100644 --- a/roadmap.txt +++ b/roadmap.txt @@ -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