expirer: make web display a bit more consistent
authorBrian Warner <warner@lothar.com>
Sat, 7 Mar 2009 23:14:42 +0000 (16:14 -0700)
committerBrian Warner <warner@lothar.com>
Sat, 7 Mar 2009 23:14:42 +0000 (16:14 -0700)
src/allmydata/storage/expirer.py
src/allmydata/test/test_storage.py
src/allmydata/web/storage.py

index 0579135a1ed4b1112337199275c7556420f8857c..42691b066b6d3a6f5024a34d58357bcc25e79be7 100644 (file)
@@ -149,6 +149,8 @@ class LeaseCheckingCrawler(ShareCrawler):
         so_far = self.state["cycle-to-date"]
         self.increment(so_far["leases-per-share-histogram"], num_leases, 1)
         so_far["shares-examined"] += 1
+        # TODO: accumulate share-sizes too, so we can display "the whole
+        # cycle would probably recover x GB out of y GB total"
 
         would_keep_share = [1, 1, 1]
 
index 7ccd2ec78f903c56919b6c36f976a0148e37276d..82dfa609e36214e80dbc512c6929109ad95eb702 100644 (file)
@@ -1618,15 +1618,15 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin):
             self.failUnlessIn("So far, this cycle has examined "
                               "1 shares in 1 buckets "
                               "and has recovered: "
-                              "0 buckets, 0 shares, 0 B ", s)
+                              "0 shares, 0 buckets, 0 B ", s)
             self.failUnlessIn("If expiration were enabled, "
                               "we would have recovered: "
-                              "0 buckets, 0 shares, 0 B by now", s)
+                              "0 shares, 0 buckets, 0 B by now", s)
             self.failUnlessIn("and the remainder of this cycle "
                               "would probably recover: "
-                              "0 buckets, 0 shares, 0 B ", s)
+                              "0 shares, 0 buckets, 0 B ", s)
             self.failUnlessIn("and the whole cycle would probably recover: "
-                              "0 buckets, 0 shares, 0 B ", s)
+                              "0 shares, 0 buckets, 0 B ", s)
             self.failUnlessIn("if we were using each lease's default "
                               "31-day lease lifetime", s)
             self.failUnlessIn("this cycle would be expected to recover: ", s)
@@ -1686,7 +1686,7 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin):
         d.addCallback(lambda ign: self.render1(webstatus))
         def _check_html(html):
             s = remove_tags(html)
-            self.failUnlessIn("recovered: 0 buckets, 0 shares, 0 B "
+            self.failUnlessIn("recovered: 0 shares, 0 buckets, 0 B "
                               "but expiration was not enabled", s)
         d.addCallback(_check_html)
         return d
@@ -1779,10 +1779,10 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin):
             # all. This part of the test depends upon the SIs landing right
             # where they do now.
             self.failUnlessIn("The remainder of this cycle is expected to "
-                              "recover: 5 buckets, 5 shares", s)
+                              "recover: 5 shares, 5 buckets", s)
             self.failUnlessIn("The whole cycle is expected to examine "
                               "6 shares in 6 buckets and to recover: "
-                              "6 buckets, 6 shares", s)
+                              "6 shares, 6 buckets", s)
         d.addCallback(_check_html_in_cycle)
 
         # wait for the crawler to finish the first cycle. Two shares should
@@ -1833,7 +1833,7 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin):
         def _check_html(html):
             s = remove_tags(html)
             self.failUnlessIn("Expiration Enabled: expired leases will be removed", s)
-            self.failUnlessIn(" recovered: 2 buckets, 2 shares, ", s)
+            self.failUnlessIn(" recovered: 2 shares, 2 buckets, ", s)
         d.addCallback(_check_html)
         return d
 
index 686e92af6540198fa080088be372e63f51b49fee..0549bc57ed96fda77940742617305bf43d6a3118 100644 (file)
@@ -139,8 +139,8 @@ class StorageStatus(rend.Page):
                 return "?"
             return "%d" % d
         space = abbreviate_space(sr["%s-diskbytes" % a])
-        return "%s buckets, %s shares, %s" % (maybe(sr["%s-numbuckets" % a]),
-                                              maybe(sr["%s-numshares" % a]),
+        return "%s shares, %s buckets, %s" % (maybe(sr["%s-numshares" % a]),
+                                              maybe(sr["%s-numbuckets" % a]),
                                               space)
 
     def render_lease_current_cycle_progress(self, ctx, data):