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
9c2e028e
Commit
9c2e028e
authored
May 21, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0992814c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
wcfs/testprog/treedelta-genallstructs.py
wcfs/testprog/treedelta-genallstructs.py
+18
-4
No files found.
wcfs/testprog/treedelta-genallstructs.py
View file @
9c2e028e
...
...
@@ -84,6 +84,11 @@ def treedeltaGenAllStructs(zstor, kv1txt, kv2txt, n):
zconn
=
db
.
open
();
defer
(
zconn
.
close
)
root
=
zconn
.
root
()
seed
=
int
(
time
.
now
())
print
(
"# seed=%d"
%
seed
)
random
.
seed
(
seed
)
# root['treedelta/values'] = {} v -> ZBlk(v)
valdict
=
root
.
setdefault
(
'treedelta/values'
,
{})
for
v
in
b'abcdefghi'
:
...
...
@@ -111,15 +116,15 @@ def treedeltaGenAllStructs(zstor, kv1txt, kv2txt, n):
maxdepth
=
2
# XXX -> 3?
maxsplit
=
1
# XXX -> 2?
t1
s
tructs
=
list
(
xbtree
.
AllStructs
(
kv1
.
keys
(),
maxdepth
,
maxsplit
))
t2
s
tructs
=
list
(
xbtree
.
AllStructs
(
kv2
.
keys
(),
maxdepth
,
maxsplit
))
t1
AllS
tructs
=
list
(
xbtree
.
AllStructs
(
kv1
.
keys
(),
maxdepth
,
maxsplit
))
t2
AllS
tructs
=
list
(
xbtree
.
AllStructs
(
kv2
.
keys
(),
maxdepth
,
maxsplit
))
# emit initial kv1 state prepared as ZODB would natively
ztree
=
valdict
[
'treedelta/tree'
]
=
XLOTree
()
for
k
in
sorted
(
kv1
):
ztree
[
k
]
=
kv1
[
k
]
transaction
.
commit
()
# XXX print
# XXX print
txnδ
t1struct0
=
xbtree
.
StructureOf
(
ztree
)
# emit initial kv2 state prepared as ZODB would natively
...
...
@@ -129,9 +134,18 @@ def treedeltaGenAllStructs(zstor, kv1txt, kv2txt, n):
else
:
ztree
[
k
]
=
v
transaction
.
commit
()
# XXX print
# XXX print
δ
t2struct0
=
xbtree
.
StructureOf
(
ztree
)
# all tree1 and tree2 topologies we are going to emit: native + n random ones
t1structv
=
[
t1struct0
]
+
random
.
sample
(
t1AllStructs
,
n
)
t2structv
=
[
t2struct0
]
+
random
.
sample
(
t2AllStructs
,
n
)
# emit tree1->tree2 and tree1<-tree2 transitions for all combinations of tree1 and tree2.
# tree1₀->tree2₀ was already emitted.
@
func
def
main
():
...
...
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