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
9f60147d
Commit
9f60147d
authored
Jun 05, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
9030f36b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
31 deletions
+43
-31
wcfs/testprog/treegen.py
wcfs/testprog/treegen.py
+43
-31
No files found.
wcfs/testprog/treegen.py
View file @
9f60147d
...
@@ -26,8 +26,8 @@ It is used as helper for ΔBTree tests.
...
@@ -26,8 +26,8 @@ It is used as helper for ΔBTree tests.
The following subcommands are provided:
The following subcommands are provided:
- `trees` transition ZODB tree through requested tree states,
- `trees` transition ZODB tree through requested tree states,
- `allstructs` generates
subset of all possible tree topologies for
changes in
- `allstructs` generates
topologies for subset of all possible tree
changes in
between two trees
represent
ed by two key->value dicts.
between two trees
specifi
ed by two key->value dicts.
Because python/pkg_resources startup is very slow(*) all subcommands can be
Because python/pkg_resources startup is very slow(*) all subcommands can be
used either in CLI or in server mode, where requests are continuously read from
used either in CLI or in server mode, where requests are continuously read from
...
@@ -39,11 +39,15 @@ Subcommands documentation follows:
...
@@ -39,11 +39,15 @@ Subcommands documentation follows:
trees
trees
-----
-----
`treegen trees <zurl>` transitions
in-
ZODB LOBTree through requested tree states.
`treegen trees <zurl>` transitions ZODB LOBTree through requested tree states.
Tree states are specified on stdin as topology-encoded strings, 1 state per 1 line.
Tree states are specified on stdin as topology-encoded strings, 1 state per 1 line.
For every request the tree is changed and modifications are committed to database.
For every request the tree is changed and modifications are committed to database.
For every made commit corresponding transaction ID is printed to stdout.
For every made commit corresponding transaction ID is printed to stdout.
The tree, that `treegen trees` works on, is also accessible via zconn.root()['treegen/tree'].
Trees protocol specification:
S: tree.srv start @<head> root=<tree-root-oid>
S: tree.srv start @<head> root=<tree-root-oid>
C: <tree>
C: <tree>
S: <tid>
S: <tid>
...
@@ -51,7 +55,7 @@ For every made commit corresponding transaction ID is printed to stdout.
...
@@ -51,7 +55,7 @@ For every made commit corresponding transaction ID is printed to stdout.
S: <tid>
S: <tid>
...
...
for example
session example:
S: tree.srv start @03d85dd71ed0d2ee root=000000000000000b
S: tree.srv start @03d85dd71ed0d2ee root=000000000000000b
C: T/B1:a
C: T/B1:a
...
@@ -60,40 +64,50 @@ for example
...
@@ -60,40 +64,50 @@ for example
S: 03d85dd871718899
S: 03d85dd871718899
...
...
The tree, that `treegen trees` works on, is also accessible as zconn.root()['treegen/tree'].
allstructs
allstructs
----------
----------
`treegen allstructs` generates subset of all possible tree changes
`treegen allstructs` generates topologies for subset of all possible tree
in between two trees that represent two specified key->value dicts.
changes in between two trees specified by two key->value dicts.
Usage: treegen allstructs <zurl> <n> <kv1> <kv2>
It generates ZODB commits with <tree1> -> <tree2> changes for subset of all
possible tree topologies tree1 and tree2 that can represent kv1 and kv2
correspondingly:
For every kv the following tree topologies are used: 1) native (the one that
For every kv the following tree topologies are used: 1) native (the one that
ZODB would usually create natively via regular usage), and 2) n random ones.
ZODB would usually create natively via regular usage), and 2) n random ones.
Then every pair of topology change in between tree1 and tree2 is considered and
Then tree topologies are emitted corresponding to tree1->tree2 and tree1<-tree2
corresponding commit is made with the tree undergoing kv1->kv2 change with
transitions for all combinations of (tree1, tree2) pairs.
tree1->tree2 transition in the database.
Allstructs protocol specification:
For every commit the following is printed to stdout:
S: # allstructs.srv start
tid <tid> # <tree1> -> <tree2>
C: <maxdepth> <maxsplit> <n>(/<seed>) <kv1> <kv2>
tree <oid>
S: # allstructs <kv1> <kv2>
δ
S: # maxdepth=<maxdepth> maxsplit=<maxsplit> n=<n> seed=<seed>
<LF>
S: <tree1₀>
S: <tree2₀>
XXX
S: <tree1₁>
...
S: # ----
session example:
# allstructs.srv start
1 1 10 1:a 2:b
# allstructs 1:a 2:b
# maxdepth=1 maxsplit=1 n=10 seed=1591369961
T/B1:a
T/B2:b
T/T/B1:a
T/B2:b
T/B1:a
T/T/B2:b
T/T/B1:a
T/T/B2:b
T/B1:a
# ----
--------
--------
(*) 300-500ms, see https://github.com/pypa/setuptools/issues/510
(*) 300-500ms, see https://github.com/pypa/setuptools/issues/510
.
"""
"""
from
__future__
import
print_function
,
absolute_import
from
__future__
import
print_function
,
absolute_import
...
@@ -171,9 +185,8 @@ class ZCtx(object):
...
@@ -171,9 +185,8 @@ class ZCtx(object):
raise
KeyError
(
"%r not found in value registry"
%
(
vobj
,))
raise
KeyError
(
"%r not found in value registry"
%
(
vobj
,))
# TreesSrv transitions ZODB tree through requested states.
# TreesSrv transitions ZODB tree through requested
tree
states.
# See top-level documentation for details.
# See top-level documentation for details.
# XXX kill TreesSrv generates tree structures given their topology encoding on input.
@
func
@
func
def
TreesSrv
(
zstor
,
r
):
def
TreesSrv
(
zstor
,
r
):
zctx
=
ZCtx
(
zstor
)
zctx
=
ZCtx
(
zstor
)
...
@@ -228,7 +241,6 @@ def TreesSrv(zstor, r):
...
@@ -228,7 +241,6 @@ def TreesSrv(zstor, r):
xprint
(
"%s"
%
ashex
(
head
))
xprint
(
"%s"
%
ashex
(
head
))
# AllStructsSrv is server version of AllStructs.
# AllStructsSrv is server version of AllStructs.
@
func
@
func
def
AllStructsSrv
(
r
):
def
AllStructsSrv
(
r
):
...
...
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