Beispiel #1
0
 def get_results(self):
     stats = DeepStats.get_results(self)
     return {"manifest": self.manifest,
             "verifycaps": self.verifycaps,
             "storage-index": self.storage_index_strings,
             "stats": stats,
             }
Beispiel #2
0
 def get_results(self):
     stats = DeepStats.get_results(self)
     return {"manifest": self.manifest,
             "verifycaps": self.verifycaps,
             "storage-index": self.storage_index_strings,
             "stats": stats,
             }
Beispiel #3
0
 def __init__(self, root, verify, repair, add_lease):
     root_si = root.get_storage_index()
     if root_si:
         root_si_base32 = base32.b2a(root_si)
     else:
         root_si_base32 = ""
     self._lp = log.msg(format="deep-check starting (%(si)s),"
                        " verify=%(verify)s, repair=%(repair)s",
                        si=root_si_base32, verify=verify, repair=repair)
     self._verify = verify
     self._repair = repair
     self._add_lease = add_lease
     if repair:
         self._results = DeepCheckAndRepairResults(root_si)
     else:
         self._results = DeepCheckResults(root_si)
     self._stats = DeepStats(root)
Beispiel #4
0
 def add_node(self, node, path):
     self.manifest.append( (tuple(path), node.get_uri()) )
     si = node.get_storage_index()
     if si:
         self.storage_index_strings.add(base32.b2a(si))
     v = node.get_verify_cap()
     if v:
         self.verifycaps.add(v.to_string())
     return DeepStats.add_node(self, node, path)
Beispiel #5
0
 def add_node(self, node, path):
     self.manifest.append( (tuple(path), node.get_uri()) )
     si = node.get_storage_index()
     if si:
         self.storage_index_strings.add(base32.b2a(si))
     v = node.get_verify_cap()
     if v:
         self.verifycaps.add(v.to_string())
     return DeepStats.add_node(self, node, path)
Beispiel #6
0
class DeepChecker:
    def __init__(self, root, verify, repair, add_lease):
        root_si = root.get_storage_index()
        if root_si:
            root_si_base32 = base32.b2a(root_si)
        else:
            root_si_base32 = ""
        self._lp = log.msg(format="deep-check starting (%(si)s),"
                           " verify=%(verify)s, repair=%(repair)s",
                           si=root_si_base32,
                           verify=verify,
                           repair=repair)
        self._verify = verify
        self._repair = repair
        self._add_lease = add_lease
        if repair:
            self._results = DeepCheckAndRepairResults(root_si)
        else:
            self._results = DeepCheckResults(root_si)
        self._stats = DeepStats(root)

    def set_monitor(self, monitor):
        self.monitor = monitor
        monitor.set_status(self._results)

    def add_node(self, node, childpath):
        if self._repair:
            d = node.check_and_repair(self.monitor, self._verify,
                                      self._add_lease)
            d.addCallback(self._results.add_check_and_repair, childpath)
        else:
            d = node.check(self.monitor, self._verify, self._add_lease)
            d.addCallback(self._results.add_check, childpath)
        d.addCallback(lambda ignored: self._stats.add_node(node, childpath))
        return d

    def enter_directory(self, parent, children):
        return self._stats.enter_directory(parent, children)

    def finish(self):
        log.msg("deep-check done", parent=self._lp)
        self._results.update_stats(self._stats.get_results())
        return self._results
Beispiel #7
0
class DeepChecker:
    def __init__(self, root, verify, repair, add_lease):
        root_si = root.get_storage_index()
        if root_si:
            root_si_base32 = base32.b2a(root_si)
        else:
            root_si_base32 = ""
        self._lp = log.msg(format="deep-check starting (%(si)s),"
                           " verify=%(verify)s, repair=%(repair)s",
                           si=root_si_base32, verify=verify, repair=repair)
        self._verify = verify
        self._repair = repair
        self._add_lease = add_lease
        if repair:
            self._results = DeepCheckAndRepairResults(root_si)
        else:
            self._results = DeepCheckResults(root_si)
        self._stats = DeepStats(root)

    def set_monitor(self, monitor):
        self.monitor = monitor
        monitor.set_status(self._results)

    def add_node(self, node, childpath):
        if self._repair:
            d = node.check_and_repair(self.monitor, self._verify, self._add_lease)
            d.addCallback(self._results.add_check_and_repair, childpath)
        else:
            d = node.check(self.monitor, self._verify, self._add_lease)
            d.addCallback(self._results.add_check, childpath)
        d.addCallback(lambda ignored: self._stats.add_node(node, childpath))
        return d

    def enter_directory(self, parent, children):
        return self._stats.enter_directory(parent, children)

    def finish(self):
        log.msg("deep-check done", parent=self._lp)
        self._results.update_stats(self._stats.get_results())
        return self._results
Beispiel #8
0
 def __init__(self, root, verify, repair, add_lease):
     root_si = root.get_storage_index()
     if root_si:
         root_si_base32 = base32.b2a(root_si)
     else:
         root_si_base32 = ""
     self._lp = log.msg(format="deep-check starting (%(si)s),"
                        " verify=%(verify)s, repair=%(repair)s",
                        si=root_si_base32, verify=verify, repair=repair)
     self._verify = verify
     self._repair = repair
     self._add_lease = add_lease
     if repair:
         self._results = DeepCheckAndRepairResults(root_si)
     else:
         self._results = DeepCheckResults(root_si)
     self._stats = DeepStats(root)
Beispiel #9
0
 def __init__(self, origin):
     DeepStats.__init__(self, origin)
     self.manifest = []
     self.storage_index_strings = set()
     self.verifycaps = set()
Beispiel #10
0
 def start_deep_stats(self):
     # Since deep_traverse tracks verifier caps, we avoid double-counting
     # children for which we've got both a write-cap and a read-cap
     return self.deep_traverse(DeepStats(self))
Beispiel #11
0
 def __init__(self, origin):
     DeepStats.__init__(self, origin)
     self.manifest = []
     self.storage_index_strings = set()
     self.verifycaps = set()