CheckResults: start hiding .data, first step to clean it up

The goal is to make CheckResults more strongly typed, and remove the
ambiguous ".data" field in favor of a bunch of specific counters and
sharelists, so I can changes .sharemap and .servermap to use IServer
instances instead of string serverids. By cleaning this up first, I hope
to get that task done with less debugging.
This commit is contained in:
Brian Warner
2012-05-14 21:57:43 -07:00
parent 17c5384f79
commit e313cf6406
4 changed files with 15 additions and 14 deletions

View File

@ -12,9 +12,9 @@ class CheckResults:
self.uri = uri
self.storage_index = storage_index
self.problems = []
self.data = {"count-corrupt-shares": 0,
"list-corrupt-shares": [],
}
self._data = {"count-corrupt-shares": 0,
"list-corrupt-shares": [],
}
self.summary = ""
self.report = []
@ -34,7 +34,7 @@ class CheckResults:
def set_needs_rebalancing(self, needs_rebalancing):
self.needs_rebalancing_p = bool(needs_rebalancing)
def set_data(self, data):
self.data.update(data)
self._data.update(data)
def set_summary(self, summary):
assert isinstance(summary, str) # should be a single string
self.summary = summary
@ -62,7 +62,7 @@ class CheckResults:
def needs_rebalancing(self):
return self.needs_rebalancing_p
def get_data(self):
return self.data
return self._data
def get_summary(self):
return self.summary