mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-21 10:01:54 +00:00
rename "checker results" to "check results", because it is more parallel to "check-and-repair results"
This commit is contained in:
parent
4ada923e2b
commit
5e6f90a015
@ -826,7 +826,7 @@ POST $URL?t=start-deep-check (must add &ophandle=XYZ)
|
||||
will continue to run in the background, and the /operations page should be
|
||||
used to find out when the operation is done.
|
||||
|
||||
Detailed checker results for non-healthy files and directories will be
|
||||
Detailed check results for non-healthy files and directories will be
|
||||
available under /operations/$HANDLE/$STORAGEINDEX, and the HTML status will
|
||||
contain links to these detailed results.
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
from zope.interface import implements
|
||||
from allmydata.interfaces import ICheckerResults, ICheckAndRepairResults, \
|
||||
from allmydata.interfaces import ICheckResults, ICheckAndRepairResults, \
|
||||
IDeepCheckResults, IDeepCheckAndRepairResults, IURI
|
||||
from allmydata.util import base32
|
||||
|
||||
class CheckerResults:
|
||||
implements(ICheckerResults)
|
||||
implements(ICheckResults)
|
||||
|
||||
def __init__(self, uri, storage_index):
|
||||
assert IURI.providedBy(uri), uri
|
||||
@ -137,7 +137,7 @@ class DeepCheckResults(DeepResultsBase):
|
||||
def add_check(self, r, path):
|
||||
if not r:
|
||||
return # non-distributed object, i.e. LIT file
|
||||
r = ICheckerResults(r)
|
||||
r = ICheckResults(r)
|
||||
assert isinstance(path, (list, tuple))
|
||||
self.objects_checked += 1
|
||||
if r.is_healthy():
|
@ -9,7 +9,7 @@ from allmydata.mutable.filenode import MutableFileNode
|
||||
from allmydata.interfaces import IMutableFileNode, IDirectoryNode,\
|
||||
IURI, IFileNode, IMutableFileURI, IFilesystemNode, \
|
||||
ExistingChildError, NoSuchChildError, ICheckable, IDeepCheckable
|
||||
from allmydata.checker_results import DeepCheckResults, \
|
||||
from allmydata.check_results import DeepCheckResults, \
|
||||
DeepCheckAndRepairResults
|
||||
from allmydata.monitor import Monitor
|
||||
from allmydata.util import hashutil, mathutil, base32, log
|
||||
|
@ -1,6 +1,6 @@
|
||||
from foolscap import DeadReferenceError
|
||||
from allmydata import hashtree
|
||||
from allmydata.checker_results import CheckerResults
|
||||
from allmydata.check_results import CheckerResults
|
||||
from allmydata.immutable import download
|
||||
from allmydata.uri import CHKFileVerifierURI
|
||||
from allmydata.util.assertutil import precondition
|
||||
|
@ -10,7 +10,7 @@ from allmydata.interfaces import IFileNode, IFileURI, ICheckable, \
|
||||
IDownloadTarget
|
||||
from allmydata.util import log, base32
|
||||
from allmydata.immutable.checker import Checker
|
||||
from allmydata.checker_results import CheckAndRepairResults
|
||||
from allmydata.check_results import CheckAndRepairResults
|
||||
from allmydata.immutable.repairer import Repairer
|
||||
from allmydata.immutable import download
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
from twisted.internet import defer
|
||||
from allmydata import storage
|
||||
from allmydata.checker_results import CheckerResults, CheckAndRepairResults
|
||||
from allmydata.check_results import CheckerResults, CheckAndRepairResults
|
||||
from allmydata.immutable import download
|
||||
from allmydata.util import nummedobj
|
||||
from allmydata.util.assertutil import precondition
|
||||
|
@ -1515,7 +1515,7 @@ class ICheckable(Interface):
|
||||
"""Check upon my health, optionally repairing any problems.
|
||||
|
||||
This returns a Deferred that fires with an instance that provides
|
||||
ICheckerResults, or None if the object is non-distributed (i.e. LIT
|
||||
ICheckResults, or None if the object is non-distributed (i.e. LIT
|
||||
files).
|
||||
|
||||
The monitor will be checked periodically to see if the operation has
|
||||
@ -1585,7 +1585,7 @@ class IDeepCheckable(Interface):
|
||||
IDeepCheckAndRepairResults object.
|
||||
"""
|
||||
|
||||
class ICheckerResults(Interface):
|
||||
class ICheckResults(Interface):
|
||||
"""I contain the detailed results of a check/verify operation.
|
||||
"""
|
||||
|
||||
@ -1704,10 +1704,10 @@ class ICheckAndRepairResults(Interface):
|
||||
was fully healthy afterwards. False if no repair was attempted or if
|
||||
a repair attempt failed."""
|
||||
def get_pre_repair_results():
|
||||
"""Return an ICheckerResults instance that describes the state of the
|
||||
"""Return an ICheckResults instance that describes the state of the
|
||||
file/dir before any repair was attempted."""
|
||||
def get_post_repair_results():
|
||||
"""Return an ICheckerResults instance that describes the state of the
|
||||
"""Return an ICheckResults instance that describes the state of the
|
||||
file/dir after any repair was attempted. If no repair was attempted,
|
||||
the pre-repair and post-repair results will be identical."""
|
||||
|
||||
@ -1741,11 +1741,11 @@ class IDeepCheckResults(Interface):
|
||||
"""
|
||||
def get_all_results():
|
||||
"""Return a dictionary mapping pathname (a tuple of strings, ready to
|
||||
be slash-joined) to an ICheckerResults instance, one for each object
|
||||
be slash-joined) to an ICheckResults instance, one for each object
|
||||
that was checked."""
|
||||
|
||||
def get_results_for_storage_index(storage_index):
|
||||
"""Retrive the ICheckerResults instance for the given (binary)
|
||||
"""Retrive the ICheckResults instance for the given (binary)
|
||||
storage index. Raises KeyError if there are no results for that
|
||||
storage index."""
|
||||
|
||||
@ -1820,15 +1820,15 @@ class IDeepCheckAndRepairResults(Interface):
|
||||
|
||||
|
||||
class IRepairable(Interface):
|
||||
def repair(checker_results):
|
||||
def repair(check_results):
|
||||
"""Attempt to repair the given object. Returns a Deferred that fires
|
||||
with a IRepairResults object.
|
||||
|
||||
I must be called with an object that implements ICheckerResults, as
|
||||
I must be called with an object that implements ICheckResults, as
|
||||
proof that you have actually discovered a problem with this file. I
|
||||
will use the data in the checker results to guide the repair process,
|
||||
such as which servers provided bad data and should therefore be
|
||||
avoided. The ICheckerResults object is inside the
|
||||
avoided. The ICheckResults object is inside the
|
||||
ICheckAndRepairResults object, which is returned by the
|
||||
ICheckable.check() method::
|
||||
|
||||
|
@ -4,7 +4,7 @@ from twisted.python import failure
|
||||
from allmydata import hashtree
|
||||
from allmydata.uri import from_string
|
||||
from allmydata.util import hashutil, base32, idlib, log
|
||||
from allmydata.checker_results import CheckAndRepairResults, CheckerResults
|
||||
from allmydata.check_results import CheckAndRepairResults, CheckerResults
|
||||
|
||||
from common import MODE_CHECK, CorruptShareError
|
||||
from servermap import ServerMap, ServermapUpdater
|
||||
|
@ -6,7 +6,7 @@ from zope.interface import implements
|
||||
from twisted.internet import defer, reactor
|
||||
from foolscap.eventual import eventually
|
||||
from allmydata.interfaces import IMutableFileNode, IMutableFileURI, \
|
||||
ICheckable, ICheckerResults, NotEnoughSharesError
|
||||
ICheckable, ICheckResults, NotEnoughSharesError
|
||||
from allmydata.util import hashutil, log
|
||||
from allmydata.util.assertutil import precondition
|
||||
from allmydata.uri import WriteableSSKFileURI
|
||||
@ -253,9 +253,9 @@ class MutableFileNode:
|
||||
#################################
|
||||
# IRepairable
|
||||
|
||||
def repair(self, checker_results, force=False):
|
||||
assert ICheckerResults(checker_results)
|
||||
r = Repairer(self, checker_results)
|
||||
def repair(self, check_results, force=False):
|
||||
assert ICheckResults(check_results)
|
||||
r = Repairer(self, check_results)
|
||||
d = r.start(force)
|
||||
return d
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
from zope.interface import implements
|
||||
from allmydata.interfaces import IRepairResults, ICheckerResults
|
||||
from allmydata.interfaces import IRepairResults, ICheckResults
|
||||
|
||||
class RepairResults:
|
||||
implements(IRepairResults)
|
||||
@ -15,10 +15,10 @@ class MustForceRepairError(Exception):
|
||||
pass
|
||||
|
||||
class Repairer:
|
||||
def __init__(self, node, checker_results):
|
||||
def __init__(self, node, check_results):
|
||||
self.node = node
|
||||
self.checker_results = ICheckerResults(checker_results)
|
||||
assert checker_results.storage_index == self.node.get_storage_index()
|
||||
self.check_results = ICheckResults(check_results)
|
||||
assert check_results.storage_index == self.node.get_storage_index()
|
||||
|
||||
def start(self, force=False):
|
||||
# download, then re-publish. If a server had a bad share, try to
|
||||
@ -47,7 +47,7 @@ class Repairer:
|
||||
# old shares: replace old shares with the latest version
|
||||
# bogus shares (bad sigs): replace the bad one with a good one
|
||||
|
||||
smap = self.checker_results.get_servermap()
|
||||
smap = self.check_results.get_servermap()
|
||||
|
||||
if smap.unrecoverable_newer_versions():
|
||||
if not force:
|
||||
|
@ -11,7 +11,7 @@ from allmydata import uri, dirnode, client
|
||||
from allmydata.introducer.server import IntroducerNode
|
||||
from allmydata.interfaces import IURI, IMutableFileNode, IFileNode, \
|
||||
FileTooLargeError, NotEnoughSharesError, ICheckable
|
||||
from allmydata.checker_results import CheckerResults, CheckAndRepairResults, \
|
||||
from allmydata.check_results import CheckerResults, CheckAndRepairResults, \
|
||||
DeepCheckResults, DeepCheckAndRepairResults
|
||||
from allmydata.mutable.common import CorruptShareError
|
||||
from allmydata.storage import storage_index_to_dir
|
||||
|
@ -15,7 +15,7 @@ from allmydata.util import hashutil, base32
|
||||
from allmydata.monitor import Monitor
|
||||
from allmydata.test.common import make_chk_file_uri, make_mutable_file_uri, \
|
||||
FakeDirectoryNode, create_chk_filenode, ErrorMixin, SystemTestMixin
|
||||
from allmydata.checker_results import CheckerResults, CheckAndRepairResults
|
||||
from allmydata.check_results import CheckerResults, CheckAndRepairResults
|
||||
import common_util as testutil
|
||||
|
||||
# to test dirnode.py, we want to construct a tree of real DirectoryNodes that
|
||||
|
@ -1,5 +1,6 @@
|
||||
from allmydata.test.common import SystemTestMixin, ShareManglingMixin
|
||||
from allmydata.monitor import Monitor
|
||||
from allmydata import check_results
|
||||
from allmydata.interfaces import IURI, NotEnoughSharesError
|
||||
from allmydata.immutable import upload
|
||||
from allmydata.util import log
|
||||
@ -794,8 +795,11 @@ class Test(ShareManglingMixin, unittest.TestCase):
|
||||
|
||||
d2 = filenode.check_and_repair(Monitor(), verify=False)
|
||||
def _after_repair(checkandrepairresults):
|
||||
assert isinstance(checkandrepairresults, check_results.CheckAndRepairResults), checkandrepairresults
|
||||
prerepairres = checkandrepairresults.get_pre_repair_results()
|
||||
assert isinstance(prerepairres, check_results.CheckResults), prerepairres
|
||||
postrepairres = checkandrepairresults.get_post_repair_results()
|
||||
assert isinstance(postrepairres, check_results.CheckResults), postrepairres
|
||||
after_repair_reads = self._count_reads()
|
||||
after_repair_allocates = self._count_allocates()
|
||||
|
||||
|
@ -14,7 +14,7 @@ from allmydata.util import idlib, mathutil
|
||||
from allmydata.util import log, base32
|
||||
from allmydata.scripts import runner
|
||||
from allmydata.interfaces import IDirectoryNode, IFileNode, IFileURI, \
|
||||
ICheckerResults, ICheckAndRepairResults, IDeepCheckResults, \
|
||||
ICheckResults, ICheckAndRepairResults, IDeepCheckResults, \
|
||||
IDeepCheckAndRepairResults, NoSuchChildError, NotEnoughSharesError
|
||||
from allmydata.monitor import Monitor, OperationCancelledError
|
||||
from allmydata.mutable.common import NotMutableError
|
||||
@ -2039,7 +2039,7 @@ class DeepCheckWebGood(DeepCheckBase, unittest.TestCase):
|
||||
return d
|
||||
|
||||
def check_is_healthy(self, cr, n, where, incomplete=False):
|
||||
self.failUnless(ICheckerResults.providedBy(cr), where)
|
||||
self.failUnless(ICheckResults.providedBy(cr), where)
|
||||
self.failUnless(cr.is_healthy(), where)
|
||||
self.failUnlessEqual(cr.get_storage_index(), n.get_storage_index(),
|
||||
where)
|
||||
@ -2622,7 +2622,7 @@ class DeepCheckWebBad(DeepCheckBase, unittest.TestCase):
|
||||
|
||||
def check_is_healthy(self, cr, where):
|
||||
try:
|
||||
self.failUnless(ICheckerResults.providedBy(cr), (cr, type(cr), where))
|
||||
self.failUnless(ICheckResults.providedBy(cr), (cr, type(cr), where))
|
||||
self.failUnless(cr.is_healthy(), (cr.get_report(), cr.is_healthy(), cr.get_summary(), where))
|
||||
self.failUnless(cr.is_recoverable(), where)
|
||||
d = cr.get_data()
|
||||
@ -2634,7 +2634,7 @@ class DeepCheckWebBad(DeepCheckBase, unittest.TestCase):
|
||||
raise
|
||||
|
||||
def check_is_missing_shares(self, cr, where):
|
||||
self.failUnless(ICheckerResults.providedBy(cr), where)
|
||||
self.failUnless(ICheckResults.providedBy(cr), where)
|
||||
self.failIf(cr.is_healthy(), where)
|
||||
self.failUnless(cr.is_recoverable(), where)
|
||||
d = cr.get_data()
|
||||
@ -2644,7 +2644,7 @@ class DeepCheckWebBad(DeepCheckBase, unittest.TestCase):
|
||||
|
||||
def check_has_corrupt_shares(self, cr, where):
|
||||
# by "corrupt-shares" we mean the file is still recoverable
|
||||
self.failUnless(ICheckerResults.providedBy(cr), where)
|
||||
self.failUnless(ICheckResults.providedBy(cr), where)
|
||||
d = cr.get_data()
|
||||
self.failIf(cr.is_healthy(), (where, cr))
|
||||
self.failUnless(cr.is_recoverable(), where)
|
||||
@ -2655,7 +2655,7 @@ class DeepCheckWebBad(DeepCheckBase, unittest.TestCase):
|
||||
return cr
|
||||
|
||||
def check_is_unrecoverable(self, cr, where):
|
||||
self.failUnless(ICheckerResults.providedBy(cr), where)
|
||||
self.failUnless(ICheckResults.providedBy(cr), where)
|
||||
d = cr.get_data()
|
||||
self.failIf(cr.is_healthy(), where)
|
||||
self.failIf(cr.is_recoverable(), where)
|
||||
|
@ -6,12 +6,12 @@ from twisted.web import http, html
|
||||
from allmydata.web.common import getxmlfile, get_arg, get_root, \
|
||||
IClient, WebError
|
||||
from allmydata.web.operations import ReloadMixin
|
||||
from allmydata.interfaces import ICheckAndRepairResults, ICheckerResults
|
||||
from allmydata.interfaces import ICheckAndRepairResults, ICheckResults
|
||||
from allmydata.util import base32, idlib
|
||||
|
||||
class ResultsBase:
|
||||
def _render_results(self, ctx, cr):
|
||||
assert ICheckerResults(cr)
|
||||
assert ICheckResults(cr)
|
||||
c = IClient(ctx)
|
||||
data = cr.get_data()
|
||||
r = []
|
||||
@ -157,7 +157,7 @@ class ResultsBase:
|
||||
return T.a(href=target)[si_s]
|
||||
|
||||
class LiteralCheckerResults(rend.Page, ResultsBase):
|
||||
docFactory = getxmlfile("literal-checker-results.xhtml")
|
||||
docFactory = getxmlfile("literal-check-results.xhtml")
|
||||
|
||||
def renderHTTP(self, ctx):
|
||||
if self.want_json(ctx):
|
||||
@ -189,10 +189,10 @@ class CheckerBase:
|
||||
return ""
|
||||
|
||||
class CheckerResults(CheckerBase, rend.Page, ResultsBase):
|
||||
docFactory = getxmlfile("checker-results.xhtml")
|
||||
docFactory = getxmlfile("check-results.xhtml")
|
||||
|
||||
def __init__(self, results):
|
||||
self.r = ICheckerResults(results)
|
||||
self.r = ICheckResults(results)
|
||||
|
||||
def json(self, ctx):
|
||||
inevow.IRequest(ctx).setHeader("content-type", "text/plain")
|
||||
@ -347,7 +347,7 @@ class DeepCheckResults(rend.Page, ResultsBase, ReloadMixin):
|
||||
all_objects = self.monitor.get_status().get_all_results()
|
||||
for path in sorted(all_objects.keys()):
|
||||
cr = all_objects[path]
|
||||
assert ICheckerResults.providedBy(cr)
|
||||
assert ICheckResults.providedBy(cr)
|
||||
if not cr.is_healthy():
|
||||
yield path, cr
|
||||
|
@ -23,7 +23,7 @@ from allmydata.web.common import text_plain, WebError, \
|
||||
getxmlfile, RenderMixin
|
||||
from allmydata.web.filenode import ReplaceMeMixin, \
|
||||
FileNodeHandler, PlaceHolderNodeHandler
|
||||
from allmydata.web.checker_results import CheckerResults, \
|
||||
from allmydata.web.check_results import CheckerResults, \
|
||||
CheckAndRepairResults, DeepCheckResults, DeepCheckAndRepairResults
|
||||
from allmydata.web.info import MoreInfo
|
||||
from allmydata.web.operations import ReloadMixin
|
||||
|
@ -14,7 +14,7 @@ from allmydata.util import log, base32
|
||||
|
||||
from allmydata.web.common import text_plain, WebError, IClient, RenderMixin, \
|
||||
boolean_of_arg, get_arg, should_create_intermediate_directories
|
||||
from allmydata.web.checker_results import CheckerResults, \
|
||||
from allmydata.web.check_results import CheckerResults, \
|
||||
CheckAndRepairResults, LiteralCheckerResults
|
||||
from allmydata.web.info import MoreInfo
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user