]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
servermap.shares_available: report N too, not just k
authorBrian Warner <warner@lothar.com>
Mon, 7 Jul 2008 22:06:15 +0000 (15:06 -0700)
committerBrian Warner <warner@lothar.com>
Mon, 7 Jul 2008 22:06:15 +0000 (15:06 -0700)
src/allmydata/mutable/servermap.py
src/allmydata/test/test_mutable.py

index 6fe605ca06ccc9566173b7cd2dfe85c7cd08f28c..37c29b3349a6f2cb607b80ce535c1b2b7942deb1 100644 (file)
@@ -186,7 +186,7 @@ class ServerMap:
 
     def shares_available(self):
         """Return a dict that maps verinfo to tuples of
-        (num_distinct_shares, k) tuples."""
+        (num_distinct_shares, k, N) tuples."""
         versionmap = self.make_versionmap()
         all_shares = {}
         for verinfo, shares in versionmap.items():
@@ -195,7 +195,7 @@ class ServerMap:
                 s.add(shnum)
             (seqnum, root_hash, IV, segsize, datalength, k, N, prefix,
              offsets_tuple) = verinfo
-            all_shares[verinfo] = (len(s), k)
+            all_shares[verinfo] = (len(s), k, N)
         return all_shares
 
     def highest_seqnum(self):
index e152b828284e8c6eeb973b6d4d53dec41f251135..c431a8be111aeae5b79993d6d2bb796248fe63a3 100644 (file)
@@ -646,7 +646,7 @@ class Servermap(unittest.TestCase):
         self.failIfEqual(best, None)
         self.failUnlessEqual(sm.recoverable_versions(), set([best]))
         self.failUnlessEqual(len(sm.shares_available()), 1)
-        self.failUnlessEqual(sm.shares_available()[best], (num_shares, 3))
+        self.failUnlessEqual(sm.shares_available()[best], (num_shares, 3, 10))
         shnum, peerids = sm.make_sharemap().items()[0]
         peerid = list(peerids)[0]
         self.failUnlessEqual(sm.version_on_peer(peerid, shnum), best)
@@ -770,7 +770,7 @@ class Servermap(unittest.TestCase):
         best = sm.best_recoverable_version()
         self.failUnlessEqual(best, None)
         self.failUnlessEqual(len(sm.shares_available()), 1)
-        self.failUnlessEqual(sm.shares_available().values()[0], (2,3) )
+        self.failUnlessEqual(sm.shares_available().values()[0], (2,3,10) )
         return sm
 
     def test_not_quite_enough_shares(self):