Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
07e27e54
Commit
07e27e54
authored
May 08, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8c6d44a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
3 deletions
+29
-3
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+29
-3
No files found.
wcfs/internal/xbtree.py
View file @
07e27e54
...
...
@@ -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
\
n
want:
\
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment