]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
CheckResults: privatize remaining attributes
authorBrian Warner <warner@lothar.com>
Fri, 25 May 2012 19:29:10 +0000 (12:29 -0700)
committerBrian Warner <warner@lothar.com>
Sat, 2 Jun 2012 18:39:10 +0000 (11:39 -0700)
src/allmydata/check_results.py
src/allmydata/immutable/filenode.py
src/allmydata/mutable/repairer.py

index 9fc7a86356b8a9a017ec7d69d4eeda9fdb30f0a5..159a5a526091628634ef4425572d910987a763e2 100644 (file)
@@ -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)
index a6eeab6e37dd4ef73e30edebd7ecdc7e42d1c865..27c1e11b1c2de2722316d7e89a1f351d47f98d28 100644 (file)
@@ -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,
index 94641e469091fe1d9014c6ff191839e1ef8c0ca4..1ec80ce20a47a9430540adf1c0b7668e308fd02f 100644 (file)
@@ -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