mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-23 09:15:32 +00:00
CheckResults: privatize remaining attributes
This commit is contained in:
@ -17,22 +17,21 @@ class CheckResults:
|
|||||||
list_incompatible_shares, count_incompatible_shares,
|
list_incompatible_shares, count_incompatible_shares,
|
||||||
summary, report, share_problems, servermap):
|
summary, report, share_problems, servermap):
|
||||||
assert IURI.providedBy(uri), uri
|
assert IURI.providedBy(uri), uri
|
||||||
self.uri = uri
|
self._uri = uri
|
||||||
self.storage_index = storage_index
|
self._storage_index = storage_index
|
||||||
self.summary = ""
|
self._summary = ""
|
||||||
self.report = []
|
self._healthy = bool(healthy)
|
||||||
self.healthy = bool(healthy)
|
if self._healthy:
|
||||||
if self.healthy:
|
|
||||||
assert recoverable
|
assert recoverable
|
||||||
if not summary:
|
if not summary:
|
||||||
summary = "healthy"
|
summary = "healthy"
|
||||||
else:
|
else:
|
||||||
if not summary:
|
if not summary:
|
||||||
summary = "not healthy"
|
summary = "not healthy"
|
||||||
self.recoverable = recoverable
|
self._recoverable = recoverable
|
||||||
if not self.recoverable:
|
if not self._recoverable:
|
||||||
assert not self.healthy
|
assert not self._healthy
|
||||||
self.needs_rebalancing_p = bool(needs_rebalancing)
|
self._needs_rebalancing_p = bool(needs_rebalancing)
|
||||||
for s in servers_responding:
|
for s in servers_responding:
|
||||||
assert isinstance(s, str), s
|
assert isinstance(s, str), s
|
||||||
for shnum, serverids in sharemap.items():
|
for shnum, serverids in sharemap.items():
|
||||||
@ -58,29 +57,29 @@ class CheckResults:
|
|||||||
}
|
}
|
||||||
self._data = data
|
self._data = data
|
||||||
assert isinstance(summary, str) # should be a single string
|
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
|
assert not isinstance(report, str) # should be list of strings
|
||||||
self.report = report
|
self._report = report
|
||||||
if servermap:
|
if servermap:
|
||||||
from allmydata.mutable.servermap import ServerMap
|
from allmydata.mutable.servermap import ServerMap
|
||||||
assert isinstance(servermap, ServerMap), servermap
|
assert isinstance(servermap, ServerMap), servermap
|
||||||
self.servermap = servermap # mutable only
|
self._servermap = servermap # mutable only
|
||||||
self._share_problems = share_problems
|
self._share_problems = share_problems
|
||||||
|
|
||||||
def get_storage_index(self):
|
def get_storage_index(self):
|
||||||
return self.storage_index
|
return self._storage_index
|
||||||
def get_storage_index_string(self):
|
def get_storage_index_string(self):
|
||||||
return base32.b2a(self.storage_index)
|
return base32.b2a(self._storage_index)
|
||||||
def get_uri(self):
|
def get_uri(self):
|
||||||
return self.uri
|
return self._uri
|
||||||
|
|
||||||
def is_healthy(self):
|
def is_healthy(self):
|
||||||
return self.healthy
|
return self._healthy
|
||||||
def is_recoverable(self):
|
def is_recoverable(self):
|
||||||
return self.recoverable
|
return self._recoverable
|
||||||
|
|
||||||
def needs_rebalancing(self):
|
def needs_rebalancing(self):
|
||||||
return self.needs_rebalancing_p
|
return self._needs_rebalancing_p
|
||||||
|
|
||||||
def get_encoding_needed(self):
|
def get_encoding_needed(self):
|
||||||
return self._data["count-shares-needed"]
|
return self._data["count-shares-needed"]
|
||||||
@ -116,13 +115,13 @@ class CheckResults:
|
|||||||
return self._data
|
return self._data
|
||||||
|
|
||||||
def get_summary(self):
|
def get_summary(self):
|
||||||
return self.summary
|
return self._summary
|
||||||
def get_report(self):
|
def get_report(self):
|
||||||
return self.report
|
return self._report
|
||||||
def get_share_problems(self):
|
def get_share_problems(self):
|
||||||
return self._share_problems
|
return self._share_problems
|
||||||
def get_servermap(self):
|
def get_servermap(self):
|
||||||
return self.servermap
|
return self._servermap
|
||||||
|
|
||||||
class CheckAndRepairResults:
|
class CheckAndRepairResults:
|
||||||
implements(ICheckAndRepairResults)
|
implements(ICheckAndRepairResults)
|
||||||
|
@ -142,7 +142,7 @@ class CiphertextFileNode:
|
|||||||
is_healthy = bool(len(sm) >= verifycap.total_shares)
|
is_healthy = bool(len(sm) >= verifycap.total_shares)
|
||||||
is_recoverable = bool(len(sm) >= verifycap.needed_shares)
|
is_recoverable = bool(len(sm) >= verifycap.needed_shares)
|
||||||
needs_rebalancing = bool(len(sm) >= verifycap.total_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,
|
healthy=is_healthy, recoverable=is_recoverable,
|
||||||
needs_rebalancing=needs_rebalancing,
|
needs_rebalancing=needs_rebalancing,
|
||||||
count_shares_needed=verifycap.needed_shares,
|
count_shares_needed=verifycap.needed_shares,
|
||||||
|
@ -28,7 +28,7 @@ class Repairer:
|
|||||||
def __init__(self, node, check_results, storage_broker, history, monitor):
|
def __init__(self, node, check_results, storage_broker, history, monitor):
|
||||||
self.node = node
|
self.node = node
|
||||||
self.check_results = ICheckResults(check_results)
|
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._storage_broker = storage_broker
|
||||||
self._history = history
|
self._history = history
|
||||||
self._monitor = monitor
|
self._monitor = monitor
|
||||||
|
Reference in New Issue
Block a user