# the permuted peerlist.
return d
+ def _do_read(self, ss, peerid, storage_index, shnums, readv):
+ # isolate the callRemote to a separate method, so tests can subclass
+ # Publish and override it
+ d = ss.callRemote("slot_readv", storage_index, shnums, readv)
+ return d
+
def _do_query(self, ss, peerid, storage_index):
self.log("querying %s" % idlib.shortnodeid_b2a(peerid))
- d = ss.callRemote("slot_readv",
- storage_index, [], [(0, self._read_size)])
+ d = self._do_read(ss, peerid, storage_index, [], [(0, self._read_size)])
return d
def _got_query_results(self, datavs, peerid, permutedid,
def _do_privkey_query(self, rref, peerid, shnum, offset, length):
started = time.time()
- d = rref.callRemote("slot_readv", self._storage_index,
- [shnum], [(offset, length)] )
+ d = self._do_read(rref, peerid, self._storage_index,
+ [shnum], [(offset, length)])
d.addCallback(self._privkey_query_response, peerid, shnum, started)
return d
return defer.succeed(None)
class FakePublish(mutable.Publish):
- def _do_query(self, ss, peerid, storage_index):
+ def _do_read(self, ss, peerid, storage_index, shnums, readv):
assert ss[0] == peerid
+ assert shnums == []
shares = self._peers[peerid]
return defer.succeed(shares)
p = FakePublish(fn)
p._storage_index = "\x00"*32
p._new_seqnum = 3
+ p._read_size = 1000
#r = mutable.Retrieve(fn)
p._peers = {}
for peerid in c._peerids: