From: Brian Warner Date: Fri, 25 May 2012 19:29:10 +0000 (-0700) Subject: CheckResults: privatize remaining attributes X-Git-Url: https://git.rkrishnan.org/webform_css?a=commitdiff_plain;h=437de4340b232a1e5ad6e3512d185d2c05752685;p=tahoe-lafs%2Ftahoe-lafs.git CheckResults: privatize remaining attributes --- diff --git a/src/allmydata/check_results.py b/src/allmydata/check_results.py index 9fc7a863..159a5a52 100644 --- a/src/allmydata/check_results.py +++ b/src/allmydata/check_results.py @@ -17,22 +17,21 @@ class CheckResults: list_incompatible_shares, count_incompatible_shares, summary, report, share_problems, servermap): assert IURI.providedBy(uri), uri - self.uri = uri - self.storage_index = storage_index - self.summary = "" - self.report = [] - self.healthy = bool(healthy) - if self.healthy: + self._uri = uri + self._storage_index = storage_index + self._summary = "" + self._healthy = bool(healthy) + if self._healthy: assert recoverable if not summary: summary = "healthy" else: if not summary: summary = "not healthy" - self.recoverable = recoverable - if not self.recoverable: - assert not self.healthy - self.needs_rebalancing_p = bool(needs_rebalancing) + self._recoverable = recoverable + if not self._recoverable: + assert not self._healthy + self._needs_rebalancing_p = bool(needs_rebalancing) for s in servers_responding: assert isinstance(s, str), s for shnum, serverids in sharemap.items(): @@ -58,29 +57,29 @@ class CheckResults: } self._data = data assert isinstance(summary, str) # should be a single string - self.summary = summary + self._summary = summary assert not isinstance(report, str) # should be list of strings - self.report = report + self._report = report if servermap: from allmydata.mutable.servermap import ServerMap assert isinstance(servermap, ServerMap), servermap - self.servermap = servermap # mutable only + self._servermap = servermap # mutable only self._share_problems = share_problems def get_storage_index(self): - return self.storage_index + return self._storage_index def get_storage_index_string(self): - return base32.b2a(self.storage_index) + return base32.b2a(self._storage_index) def get_uri(self): - return self.uri + return self._uri def is_healthy(self): - return self.healthy + return self._healthy def is_recoverable(self): - return self.recoverable + return self._recoverable def needs_rebalancing(self): - return self.needs_rebalancing_p + return self._needs_rebalancing_p def get_encoding_needed(self): return self._data["count-shares-needed"] @@ -116,13 +115,13 @@ class CheckResults: return self._data def get_summary(self): - return self.summary + return self._summary def get_report(self): - return self.report + return self._report def get_share_problems(self): return self._share_problems def get_servermap(self): - return self.servermap + return self._servermap class CheckAndRepairResults: implements(ICheckAndRepairResults) diff --git a/src/allmydata/immutable/filenode.py b/src/allmydata/immutable/filenode.py index a6eeab6e..27c1e11b 100644 --- a/src/allmydata/immutable/filenode.py +++ b/src/allmydata/immutable/filenode.py @@ -142,7 +142,7 @@ class CiphertextFileNode: is_healthy = bool(len(sm) >= verifycap.total_shares) is_recoverable = bool(len(sm) >= verifycap.needed_shares) needs_rebalancing = bool(len(sm) >= verifycap.total_shares) - prr = CheckResults(cr.uri, cr.storage_index, + prr = CheckResults(cr.get_uri(), cr.get_storage_index(), healthy=is_healthy, recoverable=is_recoverable, needs_rebalancing=needs_rebalancing, count_shares_needed=verifycap.needed_shares, diff --git a/src/allmydata/mutable/repairer.py b/src/allmydata/mutable/repairer.py index 94641e46..1ec80ce2 100644 --- a/src/allmydata/mutable/repairer.py +++ b/src/allmydata/mutable/repairer.py @@ -28,7 +28,7 @@ class Repairer: def __init__(self, node, check_results, storage_broker, history, monitor): self.node = node self.check_results = ICheckResults(check_results) - assert check_results.storage_index == self.node.get_storage_index() + assert check_results.get_storage_index() == node.get_storage_index() self._storage_broker = storage_broker self._history = history self._monitor = monitor