Commit 07e27e54 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8c6d44a3
......@@ -185,12 +185,23 @@ def StructureOf(node):
panic("unknown node type %r" % typ)
# Restructure reorganizes BTree instance (not Tree) according to new structure.
def Restructure(tree, newStructure):
assert istree(tree)
# Restructure reorganizes ZODB BTree instance (not Tree) according to specified
# structure.
def Restructure(ztree, newStructure):
assert istree(ztree) # XXX -> use bcheck.classify
assert isinstance(newStructure, Tree)
1/0
_bcheck(ztree) # verify ztree before our tweaks
_bcheck(ztree) # verify ztree after our tweaks
tstruct = StructureOf(ztree)
if tstruct != newStructure:
panic("BUG: Restructure: result structure is not what was"
"requested:\n%s\n\nwant:\n%s" % (tstruct, newStructure))
# AllStructs generates subset of all possible BTree structures for BTrees with
# specified keys and btree depth up-to maxdepth. Each tree node is split by
# up-to maxsplit points.
......@@ -399,6 +410,21 @@ def _assertIncv(v):
prev = v[i]
# _bcheck performs checks on ztree provided by ZODB packages.
# the checks are what BTree.check and node._check() provide.
class _ZChecker(_bcheck.Checker):
def visit_btree(self, obj, *argv):
super(_ZChecker, self).visit_btree(obj, *argv)
obj._check() # also check internal C-level pointers consistency
def visit_bucket(self, obj, *argv):
super(_ZChecker, self).visit_bucket(obj, *argv)
obj._check() # ----//-----
def _bcheck(ztree):
_ZChecker(ztree).check()
_bcheck.check(ztree)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment