mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-22 06:17:50 +00:00
add RemoteInterfaces (foolscap schemas). some tests break.
This commit is contained in:
parent
18d8911c51
commit
e9d67ecc49
@ -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
|
||||
|
@ -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'
|
||||
|
||||
|
41
allmydata/interfaces.py
Normal file
41
allmydata/interfaces.py
Normal file
@ -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
|
||||
|
||||
|
@ -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 = {}
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user