From: Brian Warner Date: Wed, 13 Aug 2008 03:35:30 +0000 (-0700) Subject: immutable checker: add a status_report field X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/frontends/COPYING.GPL?a=commitdiff_plain;h=97852cd626a436fb26a30dd97ca1d6293ebe9b76;p=tahoe-lafs%2Ftahoe-lafs.git immutable checker: add a status_report field --- diff --git a/src/allmydata/immutable/checker.py b/src/allmydata/immutable/checker.py index c84f7fe9..fa1d6afb 100644 --- a/src/allmydata/immutable/checker.py +++ b/src/allmydata/immutable/checker.py @@ -24,6 +24,7 @@ class Results: self.storage_index_s = "" else: self.storage_index_s = base32.b2a(storage_index)[:6] + self.status_report = "[not generated yet]" # string def is_healthy(self): return self.healthy @@ -45,6 +46,9 @@ class Results: s += "Healthy!\n" else: s += "Not Healthy!\n" + s += "\n" + s += self.status_report + s += "\n" return s class DeepCheckResults: @@ -149,9 +153,17 @@ class SimpleCHKFileChecker: def _done(self, res): r = Results(self.storage_index) + report = [] r.healthy = bool(len(self.found_shares) >= self.total_shares) r.stuff = (self.needed_shares, self.total_shares, len(self.found_shares), self.sharemap) + if len(self.found_shares) < self.total_shares: + wanted = set(range(self.total_shares)) + missing = wanted - self.found_shares + report.append("Missing shares: %s" % + ",".join(["sh%d" % shnum + for shnum in sorted(missing)])) + r.status_report = "\n".join(report) + "\n" return r class VerifyingOutput: