I'm also responsible for subscribing to the IntroducerClient to find out
about new servers as they are announced by the Introducer.
"""
- def __init__(self, tub, permute_peers, preferred_peers):
+ def __init__(self, tub, permute_peers, preferred_peers=()):
self.tub = tub
assert permute_peers # False not implemented yet
self.permute_peers = permute_peers
from allmydata.node import Node, OldConfigError, OldConfigOptionError, MissingConfigEntry, UnescapedHashError
from allmydata import client
from allmydata.storage_client import StorageFarmBroker
-from allmydata.util import base32, fileutil, idlib
+from allmydata.util import base32, fileutil
from allmydata.interfaces import IFilesystemNode, IFileNode, \
IImmutableFileNode, IMutableFileNode, IDirectoryNode
from foolscap.api import flushEventualQueue
return [ s.get_longname() for s in sb.get_servers_for_psi(key) ]
def test_permute(self):
- sb = StorageFarmBroker(None, True, [])
+ sb = StorageFarmBroker(None, True)
for k in ["%d" % i for i in range(5)]:
ann = {"anonymous-storage-FURL": "pb://abcde@nowhere/fake",
"permutation-seed-base32": base32.b2a(k) }
self.failUnlessReallyEqual(self._permute(sb, "one"), [])
def test_permute_with_preferred(self):
- sb = StorageFarmBroker(None, True, map(idlib.nodeid_b2a, ['1','4']))
+ sb = StorageFarmBroker(None, True, ['1','4'])
for k in ["%d" % i for i in range(5)]:
- sb.test_add_rref(k, "rref")
+ ann = {"anonymous-storage-FURL": "pb://abcde@nowhere/fake",
+ "permutation-seed-base32": base32.b2a(k) }
+ sb.test_add_rref(k, "rref", ann)
self.failUnlessReallyEqual(self._permute(sb, "one"), ['1','4','3','0','2'])
self.failUnlessReallyEqual(self._permute(sb, "two"), ['4','1','0','2','3'])