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
986ff81d
Commit
986ff81d
authored
May 01, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d278bef2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+5
-2
wcfs/internal/xbtree_test.py
wcfs/internal/xbtree_test.py
+9
-3
No files found.
wcfs/internal/xbtree.py
View file @
986ff81d
...
...
@@ -18,10 +18,13 @@
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
"""Package xbtree provides utilities for inspecting/manipulating internal structure of BTrees.
"""Package xbtree provides utilities for inspecting/manipulating internal
structure of integer-keyed BTrees.
It is primarily used to verify ΔBTail in wcfs.
- `Tree` represents a tree node.
- `Bucket` represents a bucket node.
XXX Typology:
"""
...
...
@@ -97,7 +100,7 @@ def StructureOf(node):
if
is_tree
:
kind
,
keys
,
children
=
bcheck
.
crack_btree
(
node
,
is_map
)
if
kind
==
bcheck
.
BTREE_EMPTY
:
return
Tree
([])
return
Tree
([]
,
Bucket
()
)
if
kind
==
bcheck
.
BTREE_ONE
:
b
=
node
.
_bucket_type
()
...
...
wcfs/internal/xbtree_test.py
View file @
986ff81d
...
...
@@ -19,15 +19,21 @@
# See https://www.nexedi.com/licensing for rationale and options.
from
wendelin.wcfs.internal
import
xbtree
from
BTrees.LOBTree
import
LOBTree
from
BTrees.tests
import
testBTrees
def
test_topologyOf
():
T
=
xbtree
.
Tree
B
=
xbtree
.
Bucket
# XXX empty
# empty tree
t
=
LOBTree
()
assert
xbtree
.
StructureOf
(
t
)
==
T
([],
B
())
# XXX 1 k->v
# tree with 1 k->v
t
=
LOBTree
()
t
[
10
]
=
'hello'
assert
xbtree
.
StructureOf
(
t
)
==
T
([],
B
(
10
))
# known degenerate topology, see:
# https://github.com/zopefoundation/ZODB/commit/6cd24e99f89b
...
...
@@ -44,7 +50,7 @@ def test_topologyOf():
T
([],
B
(
7
)),
T
([],
B
(
11
)))
))
assert
btree
.
TopoEncodingOf
(
t
)
==
((
4
,),
(
2
,),
ø
(
4
),
(
6
,
10
),
ø
(
5
?
),
ø
(
7
),
ø
(
11
),
x
(
5
?
))
#
assert btree.TopoEncodingOf(t) == ((4,), (2,), ø(4), (6,10), ø(5?), ø(7), ø(11), x(5?))
"""
assert xbtree.TopologyOf(t) == ( (4,),
...
...
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