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
63ae145f
Commit
63ae145f
authored
May 12, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8e6bc9b7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
9 deletions
+29
-9
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+29
-9
No files found.
wcfs/internal/xbtree.py
View file @
63ae145f
...
...
@@ -232,13 +232,16 @@ def Restructure(ztree, newStructure):
# - bucket.next_bucket will point to bucket that is coming next in the tree
tnew
=
newStructure
.
copy
()
zlevelv
=
list
(
_zwalkBFS
(
ztree
))
levelv
=
list
(
_walkBFS
(
tnew
))
# assotiate every node in tnew to a znode
while
len
(
levelv
)
>
0
:
level
=
levelv
.
pop
(
0
)
if
len
(
zlevelv
)
==
0
:
zrlevelv
=
list
(
__zwalkBFS
(
ztree
))
# [] of _NodeInRange
rlevelv
=
list
(
__walkBFS
(
tnew
))
# [] of _NodeInRange
# assotiate every non-bucket node in tnew to a znode
# extract bucket nodes.
zrbucketv
=
[]
# of _NodeInRange
rbucketv
=
[]
# of _NodeInRange
while
len
(
rlevelv
)
>
0
:
rlevel
=
rlevelv
.
pop
(
0
)
if
len
(
zrlevelv
)
==
0
:
panic
(
"TODO"
)
zlevel
=
zlevelv
.
pop
(
0
)
...
...
@@ -250,7 +253,24 @@ def Restructure(ztree, newStructure):
else
:
panic
(
"TODO"
)
if
len
(
zlevelv
)
>
0
:
if
len
(
zrlevelv
)
>
0
:
panic
(
"TODO"
)
# TODO order queued buckets and zbuckets
# chain buckets via .next_bucket
assert
len
(
rbucketv
)
>
0
for
i
in
range
(
len
(
rbucketv
)
-
1
):
rbucketv
[
i
].
node
.
next_bucket
=
rbucketv
[
i
+
1
].
node
rbucketv
[
-
1
].
node
.
next_bucket
=
None
# associate every bucket to zbucket
if
len
(
zrbucketv
)
==
len
(
rbucketv
):
for
(
zrbucket
,
rbucket
)
in
zip
(
zrbucketv
,
rbucketv
):
rbucket
.
node
.
Z
=
zrbucket
.
node
else
:
panic
(
"TODO"
)
...
...
@@ -442,7 +462,7 @@ class _Range:
return
"[%s, %s)"
%
(
r
.
klo
,
r
.
khi
)
__repr__
=
__str__
# _NodeInRange represents a node (node or znode) coming under range in its tree.
# _NodeInRange represents a node (node or znode) coming under
key
range in its tree.
class
_NodeInRange
:
# .range
# .node
...
...
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