mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-23 09:15:32 +00:00
CheckResults: replace get_data() with a bunch of individual getters
This commit is contained in:
@ -78,6 +78,37 @@ class CheckResults:
|
|||||||
|
|
||||||
def needs_rebalancing(self):
|
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"]
|
||||||
|
def get_encoding_expected(self):
|
||||||
|
return self._data["count-shares-expected"]
|
||||||
|
|
||||||
|
def get_share_counter_good(self):
|
||||||
|
return self._data["count-shares-good"]
|
||||||
|
def get_share_counter_wrong(self):
|
||||||
|
return self._data["count-wrong-shares"]
|
||||||
|
|
||||||
|
def get_corrupt_shares(self):
|
||||||
|
return self._data["list-corrupt-shares"]
|
||||||
|
|
||||||
|
def get_incompatible_shares(self):
|
||||||
|
return self._data["list-incompatible-shares"]
|
||||||
|
|
||||||
|
def get_servers_responding(self):
|
||||||
|
return self._data["servers-responding"]
|
||||||
|
|
||||||
|
def get_host_counter_good_shares(self):
|
||||||
|
return self._data["count-good-share-hosts"]
|
||||||
|
|
||||||
|
def get_version_counter_recoverable(self):
|
||||||
|
return self._data["count-recoverable-versions"]
|
||||||
|
def get_version_counter_unrecoverable(self):
|
||||||
|
return self._data["count-unrecoverable-versions"]
|
||||||
|
|
||||||
|
def get_sharemap(self):
|
||||||
|
return self._data["sharemap"]
|
||||||
|
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
return self._data
|
return self._data
|
||||||
|
|
||||||
|
@ -2131,80 +2131,73 @@ class ICheckResults(Interface):
|
|||||||
files always return True."""
|
files always return True."""
|
||||||
|
|
||||||
def needs_rebalancing():
|
def needs_rebalancing():
|
||||||
"""Return a boolean, True if the file/dir's reliability could be
|
"""Return a boolean, True if the file/dirs reliability could be
|
||||||
improved by moving shares to new servers. Non-distributed LIT files
|
improved by moving shares to new servers. Non-distributed LIT files
|
||||||
always return False."""
|
always return False."""
|
||||||
|
|
||||||
|
# the following methods all return None for non-distributed LIT files
|
||||||
|
|
||||||
def get_data():
|
def get_encoding_needed():
|
||||||
"""Return a dictionary that describes the state of the file/dir. LIT
|
"""Return 'k', the number of shares required for recovery"""
|
||||||
files always return an empty dictionary. Normal files and directories
|
def get_encoding_expected():
|
||||||
return a dictionary with the following keys (note that these use
|
"""Return 'N', the number of total shares generated"""
|
||||||
binary strings rather than base32-encoded ones) (also note that for
|
|
||||||
mutable files, these counts are for the 'best' version):
|
|
||||||
|
|
||||||
count-shares-good: the number of distinct good shares that were found
|
def get_share_counter_good():
|
||||||
count-shares-needed: 'k', the number of shares required for recovery
|
"""Return the number of distinct good shares that were found. For
|
||||||
count-shares-expected: 'N', the number of total shares generated
|
mutable files, this counts shares for the 'best' version."""
|
||||||
count-good-share-hosts: the number of distinct storage servers with
|
def get_share_counter_wrong():
|
||||||
good shares. If this number is less than
|
"""For mutable files, return the number of shares for versions other
|
||||||
count-shares-good, then some shares are
|
than the 'best' one (which is defined as being the recoverable
|
||||||
doubled up, increasing the correlation of
|
version with the highest sequence number, then the highest roothash).
|
||||||
failures. This indicates that one or more
|
These are either leftover shares from an older version (perhaps on a
|
||||||
shares should be moved to an otherwise unused
|
server that was offline when an update occurred), shares from an
|
||||||
server, if one is available.
|
unrecoverable newer version, or shares from an alternate current
|
||||||
count-corrupt-shares: the number of shares with integrity failures
|
version that results from an uncoordinated write collision. For a
|
||||||
list-corrupt-shares: a list of 'share locators', one for each share
|
healthy file, this will equal 0. For immutable files, this will
|
||||||
that was found to be corrupt. Each share
|
always equal 0."""
|
||||||
locator is a list of (serverid, storage_index,
|
|
||||||
sharenum).
|
|
||||||
count-incompatible-shares: the number of shares which are of a share
|
|
||||||
format unknown to this checker
|
|
||||||
list-incompatible-shares: a list of 'share locators', one for each
|
|
||||||
share that was found to be of an unknown
|
|
||||||
format. Each share locator is a list of
|
|
||||||
(serverid, storage_index, sharenum).
|
|
||||||
servers-responding: list of (binary) storage server identifiers,
|
|
||||||
one for each server which responded to the share
|
|
||||||
query (even if they said they didn't have
|
|
||||||
shares, and even if they said they did have
|
|
||||||
shares but then didn't send them when asked, or
|
|
||||||
dropped the connection, or returned a Failure,
|
|
||||||
and even if they said they did have shares and
|
|
||||||
sent incorrect ones when asked)
|
|
||||||
sharemap: dict mapping share identifier to list of serverids
|
|
||||||
(binary strings). This indicates which servers are holding
|
|
||||||
which shares. For immutable files, the shareid is an
|
|
||||||
integer (the share number, from 0 to N-1). For mutable
|
|
||||||
files, it is a string of the form 'seq%d-%s-sh%d',
|
|
||||||
containing the sequence number, the roothash, and the
|
|
||||||
share number.
|
|
||||||
|
|
||||||
The following keys are most relevant for mutable files, but immutable
|
def get_corrupt_shares():
|
||||||
files will provide sensible values too::
|
"""Return a list of 'share locators', one for each share that was
|
||||||
|
found to be corrupt (integrity failure). Each share locator is a list
|
||||||
|
of (serverid, storage_index, sharenum)."""
|
||||||
|
|
||||||
count-wrong-shares: the number of shares for versions other than the
|
def get_incompatible_shares():
|
||||||
'best' one (which is defined as being the
|
"""Return a list of 'share locators', one for each share that was
|
||||||
recoverable version with the highest sequence
|
found to be of an unknown format. Each share locator is a list of
|
||||||
number, then the highest roothash). These are
|
(serverid, storage_index, sharenum)."""
|
||||||
either leftover shares from an older version
|
|
||||||
(perhaps on a server that was offline when an
|
|
||||||
update occurred), shares from an unrecoverable
|
|
||||||
newer version, or shares from an alternate
|
|
||||||
current version that results from an
|
|
||||||
uncoordinated write collision. For a healthy
|
|
||||||
file, this will equal 0.
|
|
||||||
|
|
||||||
count-recoverable-versions: the number of recoverable versions of
|
def get_servers_responding():
|
||||||
the file. For a healthy file, this will
|
"""Return a list of (binary) storage server identifiers, one for each
|
||||||
equal 1.
|
server which responded to the share query (even if they said they
|
||||||
|
didn't have shares, and even if they said they did have shares but
|
||||||
count-unrecoverable-versions: the number of unrecoverable versions
|
then didn't send them when asked, or dropped the connection, or
|
||||||
of the file. For a healthy file, this
|
returned a Failure, and even if they said they did have shares and
|
||||||
will be 0.
|
sent incorrect ones when asked)"""
|
||||||
|
|
||||||
|
def get_host_counter_good_shares():
|
||||||
|
"""Return the number of distinct storage servers with good shares. If
|
||||||
|
this number is less than get_share_counters()[good], then some shares
|
||||||
|
are doubled up, increasing the correlation of failures. This
|
||||||
|
indicates that one or more shares should be moved to an otherwise
|
||||||
|
unused server, if one is available.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def get_version_counter_recoverable():
|
||||||
|
"""Return the number of recoverable versions of the file. For a
|
||||||
|
healthy file, this will equal 1."""
|
||||||
|
|
||||||
|
def get_version_counter_unrecoverable():
|
||||||
|
"""Return the number of unrecoverable versions of the file. For a
|
||||||
|
healthy file, this will be 0."""
|
||||||
|
|
||||||
|
def get_sharemap():
|
||||||
|
"""Return a dict mapping share identifier to list of serverids
|
||||||
|
(binary strings). This indicates which servers are holding which
|
||||||
|
shares. For immutable files, the shareid is an integer (the share
|
||||||
|
number, from 0 to N-1). For mutable files, it is a string of the form
|
||||||
|
'seq%d-%s-sh%d', containing the sequence number, the roothash, and
|
||||||
|
the share number."""
|
||||||
|
|
||||||
def get_summary():
|
def get_summary():
|
||||||
"""Return a string with a brief (one-line) summary of the results."""
|
"""Return a string with a brief (one-line) summary of the results."""
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user