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
6b76ad1f
Commit
6b76ad1f
authored
May 26, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
bdbe0182
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
wcfs/testprog/treegen.py
wcfs/testprog/treegen.py
+16
-5
No files found.
wcfs/testprog/treegen.py
View file @
6b76ad1f
...
@@ -206,11 +206,11 @@ def AllStructs(zstor, kv1txt, kv2txt, n, seed=None):
...
@@ -206,11 +206,11 @@ def AllStructs(zstor, kv1txt, kv2txt, n, seed=None):
# emit patches ztree with delta, adjusts tree structure and emits corresponding commit.
# emit patches ztree with delta, adjusts tree structure and emits corresponding commit.
def
emit
(
delta
,
verify
,
treeTopo
):
def
emit
(
delta
,
verify
,
treeTopo
):
ttxt_prev
=
treetxt
(
ztree
,
zctx
.
vencod
e
)
ttxt_prev
=
zctx
.
ztreetxt
(
ztre
e
)
patch
(
ztree
,
delta
,
verify
)
patch
(
ztree
,
delta
,
verify
)
if
treeTopo
is
not
None
:
if
treeTopo
is
not
None
:
xbtree
.
Restructure
(
ztree
,
treeTopo
)
xbtree
.
Restructure
(
ztree
,
treeTopo
)
ttxt
=
treetxt
(
ztree
,
zctx
.
vencod
e
)
ttxt
=
zctx
.
ztreetxt
(
ztre
e
)
tid
=
commit
(
'%s -> %s'
%
(
ttxt_prev
,
ttxt
))
tid
=
commit
(
'%s -> %s'
%
(
ttxt_prev
,
ttxt
))
print
(
'txn %s # %s -> %s'
%
(
ashex
(
tid
),
ttxt_prev
,
ttxt
))
print
(
'txn %s # %s -> %s'
%
(
ashex
(
tid
),
ttxt_prev
,
ttxt
))
for
(
k
,
v
)
in
delta
:
for
(
k
,
v
)
in
delta
:
...
@@ -348,9 +348,20 @@ def commit(description): # -> tid
...
@@ -348,9 +348,20 @@ def commit(description): # -> tid
return
obj
.
_p_serial
return
obj
.
_p_serial
# treetxt returns text representation of a tree.
# ztreetxt returns text representation of a ZODB tree.
def
treetxt
(
ztree
,
vencode
):
# -> txt
@
func
(
ZCtx
)
return
xbtree
.
TopoEncode
(
xbtree
.
StructureOf
(
ztree
),
vencode
)
def
ztreetxt
(
zctx
,
ztree
):
# -> txt
assert
ztree
.
_p_jar
is
zctx
.
zconn
return
zctx
.
TopoEncode
(
xbtree
.
StructureOf
(
ztree
))
# TopoEncode and TopoDecode perform trees encode/decode with values registry
# taken from zctx.valdict.
@
func
(
ZCtx
)
def
TopoEncode
(
zctx
,
tree
):
return
xbtree
.
TopoEncode
(
tree
,
zctx
.
vencode
)
@
func
(
ZCtx
)
def
TopoDecode
(
zctx
,
text
):
return
xbtree
.
TopoDecode
(
text
,
zctx
.
vdecode
)
@
func
@
func
...
...
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