From 97852cd626a436fb26a30dd97ca1d6293ebe9b76 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 12 Aug 2008 20:35:30 -0700 Subject: [PATCH] immutable checker: add a status_report field --- src/allmydata/immutable/checker.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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: -- 2.45.2