from twisted.internet import defer
+import allmydata
from allmydata.Crypto.Util.number import bytes_to_long
from allmydata.storageserver import StorageServer
from allmydata.upload import Uploader
INTRODUCER_FURL_FILE = "introducer.furl"
GLOBAL_VDRIVE_FURL_FILE = "vdrive.furl"
+ # we're pretty narrow-minded right now
+ OLDEST_SUPPORTED_VERSION = allmydata.__version__
+
def __init__(self, basedir="."):
node.Node.__init__(self, basedir)
self.my_pburl = None
self.connected_to_vdrive = False
vdrive_root.notifyOnDisconnect(_disconnected)
+ def remote_get_versions(self):
+ return str(allmydata.__version__), str(self.OLDEST_SUPPORTED_VERSION)
+
def remote_get_service(self, name):
# TODO: 'vdrive' should not be public in the medium term
return self.getServiceNamed(name)
return None
class RIClient(RemoteInterface):
+ def get_versions():
+ """Return a tuple of (my_version, oldest_supported) strings.
+
+ Each string can be parsed by an allmydata.util.version.Version
+ instance, and then compared. The first goal is to make sure that
+ nodes are not confused by speaking to an incompatible peer. The
+ second goal is to enable the development of backwards-compatibility
+ code.
+
+ This method is likely to change in incompatible ways until we get the
+ whole compatibility scheme nailed down.
+ """
+ return TupleOf(str, str)
def get_service(name=str):
return Referenceable
def get_nodeid():
import os
from twisted.trial import unittest
+import allmydata
from allmydata import client, introducer
+from allmydata.util import version
class MyIntroducerClient(introducer.IntroducerClient):
def __init__(self):
c2.introducer_client.connections[k] = None
self.failUnlessEqual(permute(c2, "one"), ['3','1','0','4','2'])
+ def test_versions(self):
+ basedir = "test_client.Basic.test_versions"
+ os.mkdir(basedir)
+ open(os.path.join(basedir, "introducer.furl"), "w").write("")
+ open(os.path.join(basedir, "vdrive.furl"), "w").write("")
+ c = client.Client(basedir)
+ mine, oldest = c.remote_get_versions()
+ self.failUnlessEqual(version.Version(mine), allmydata.__version__)
+