From 5e6f90a015d4ffc48fd74ed8785c2d3ba474d0a9 Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx <zooko@zooko.com> Date: Tue, 6 Jan 2009 13:37:03 -0700 Subject: [PATCH] rename "checker results" to "check results", because it is more parallel to "check-and-repair results" --- docs/frontends/webapi.txt | 2 +- .../{checker_results.py => check_results.py} | 6 +++--- src/allmydata/dirnode.py | 2 +- src/allmydata/immutable/checker.py | 2 +- src/allmydata/immutable/filenode.py | 2 +- src/allmydata/immutable/repairer.py | 2 +- src/allmydata/interfaces.py | 18 +++++++++--------- src/allmydata/mutable/checker.py | 2 +- src/allmydata/mutable/filenode.py | 8 ++++---- src/allmydata/mutable/repairer.py | 10 +++++----- src/allmydata/test/common.py | 2 +- src/allmydata/test/test_dirnode.py | 2 +- src/allmydata/test/test_immutable.py | 4 ++++ src/allmydata/test/test_system.py | 12 ++++++------ ...ecker-results.xhtml => check-results.xhtml} | 0 .../{checker_results.py => check_results.py} | 12 ++++++------ src/allmydata/web/directory.py | 2 +- src/allmydata/web/filenode.py | 2 +- ...sults.xhtml => literal-check-results.xhtml} | 0 19 files changed, 47 insertions(+), 43 deletions(-) rename src/allmydata/{checker_results.py => check_results.py} (98%) rename src/allmydata/web/{checker-results.xhtml => check-results.xhtml} (100%) rename src/allmydata/web/{checker_results.py => check_results.py} (98%) rename src/allmydata/web/{literal-checker-results.xhtml => literal-check-results.xhtml} (100%) diff --git a/docs/frontends/webapi.txt b/docs/frontends/webapi.txt index 426ff7be..29fae18b 100644 --- a/docs/frontends/webapi.txt +++ b/docs/frontends/webapi.txt @@ -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. diff --git a/src/allmydata/checker_results.py b/src/allmydata/check_results.py similarity index 98% rename from src/allmydata/checker_results.py rename to src/allmydata/check_results.py index bfcc7906..d4951151 100644 --- a/src/allmydata/checker_results.py +++ b/src/allmydata/check_results.py @@ -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(): diff --git a/src/allmydata/dirnode.py b/src/allmydata/dirnode.py index 9f2e1d25..9c38f86d 100644 --- a/src/allmydata/dirnode.py +++ b/src/allmydata/dirnode.py @@ -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 diff --git a/src/allmydata/immutable/checker.py b/src/allmydata/immutable/checker.py index bcccd8a9..290d8cfd 100644 --- a/src/allmydata/immutable/checker.py +++ b/src/allmydata/immutable/checker.py @@ -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 diff --git a/src/allmydata/immutable/filenode.py b/src/allmydata/immutable/filenode.py index e8e9d96b..45a4a600 100644 --- a/src/allmydata/immutable/filenode.py +++ b/src/allmydata/immutable/filenode.py @@ -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 diff --git a/src/allmydata/immutable/repairer.py b/src/allmydata/immutable/repairer.py index 4f0e3f79..9d41529d 100644 --- a/src/allmydata/immutable/repairer.py +++ b/src/allmydata/immutable/repairer.py @@ -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 diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py index a176e01c..bfd0477e 100644 --- a/src/allmydata/interfaces.py +++ b/src/allmydata/interfaces.py @@ -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:: diff --git a/src/allmydata/mutable/checker.py b/src/allmydata/mutable/checker.py index 31e8744c..ed9ddb3b 100644 --- a/src/allmydata/mutable/checker.py +++ b/src/allmydata/mutable/checker.py @@ -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 diff --git a/src/allmydata/mutable/filenode.py b/src/allmydata/mutable/filenode.py index 8caa1454..1951ff1d 100644 --- a/src/allmydata/mutable/filenode.py +++ b/src/allmydata/mutable/filenode.py @@ -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 diff --git a/src/allmydata/mutable/repairer.py b/src/allmydata/mutable/repairer.py index f3ae1ce6..b7d49bcd 100644 --- a/src/allmydata/mutable/repairer.py +++ b/src/allmydata/mutable/repairer.py @@ -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: diff --git a/src/allmydata/test/common.py b/src/allmydata/test/common.py index e21cccc8..5ed13d0b 100644 --- a/src/allmydata/test/common.py +++ b/src/allmydata/test/common.py @@ -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 diff --git a/src/allmydata/test/test_dirnode.py b/src/allmydata/test/test_dirnode.py index 916c9eaa..52e2cfd1 100644 --- a/src/allmydata/test/test_dirnode.py +++ b/src/allmydata/test/test_dirnode.py @@ -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 diff --git a/src/allmydata/test/test_immutable.py b/src/allmydata/test/test_immutable.py index 34ee3a84..7c7923db 100644 --- a/src/allmydata/test/test_immutable.py +++ b/src/allmydata/test/test_immutable.py @@ -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() diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 0dad06fc..32968192 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -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) diff --git a/src/allmydata/web/checker-results.xhtml b/src/allmydata/web/check-results.xhtml similarity index 100% rename from src/allmydata/web/checker-results.xhtml rename to src/allmydata/web/check-results.xhtml diff --git a/src/allmydata/web/checker_results.py b/src/allmydata/web/check_results.py similarity index 98% rename from src/allmydata/web/checker_results.py rename to src/allmydata/web/check_results.py index 12fd955d..529965ef 100644 --- a/src/allmydata/web/checker_results.py +++ b/src/allmydata/web/check_results.py @@ -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 diff --git a/src/allmydata/web/directory.py b/src/allmydata/web/directory.py index 23306729..0ac24bc2 100644 --- a/src/allmydata/web/directory.py +++ b/src/allmydata/web/directory.py @@ -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 diff --git a/src/allmydata/web/filenode.py b/src/allmydata/web/filenode.py index e8d52229..0061805f 100644 --- a/src/allmydata/web/filenode.py +++ b/src/allmydata/web/filenode.py @@ -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 diff --git a/src/allmydata/web/literal-checker-results.xhtml b/src/allmydata/web/literal-check-results.xhtml similarity index 100% rename from src/allmydata/web/literal-checker-results.xhtml rename to src/allmydata/web/literal-check-results.xhtml -- 2.45.2