Commit 9f60147d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 9030f36b
......@@ -26,8 +26,8 @@ It is used as helper for ΔBTree tests.
The following subcommands are provided:
- `trees` transition ZODB tree through requested tree states,
- `allstructs` generates subset of all possible tree topologies for changes in
between two trees represented by two key->value dicts.
- `allstructs` generates topologies for subset of all possible tree changes in
between two trees specified by two key->value dicts.
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
......@@ -39,11 +39,15 @@ Subcommands documentation follows:
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.
For every request the tree is changed and modifications are committed to database.
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>
C: <tree>
S: <tid>
......@@ -51,7 +55,7 @@ For every made commit corresponding transaction ID is printed to stdout.
S: <tid>
...
for example
session example:
S: tree.srv start @03d85dd71ed0d2ee root=000000000000000b
C: T/B1:a
......@@ -60,40 +64,50 @@ for example
S: 03d85dd871718899
...
The tree, that `treegen trees` works on, is also accessible as zconn.root()['treegen/tree'].
allstructs
----------
`treegen allstructs` generates subset of all possible tree changes
in between two trees that represent two specified 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:
`treegen allstructs` generates topologies for subset of all possible tree
changes in between two trees specified by two key->value dicts.
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.
Then every pair of topology change in between tree1 and tree2 is considered and
corresponding commit is made with the tree undergoing kv1->kv2 change with
tree1->tree2 transition in the database.
For every commit the following is printed to stdout:
tid <tid> # <tree1> -> <tree2>
tree <oid>
δ
<LF>
XXX
Then tree topologies are emitted corresponding to tree1->tree2 and tree1<-tree2
transitions for all combinations of (tree1, tree2) pairs.
Allstructs protocol specification:
S: # allstructs.srv start
C: <maxdepth> <maxsplit> <n>(/<seed>) <kv1> <kv2>
S: # allstructs <kv1> <kv2>
S: # maxdepth=<maxdepth> maxsplit=<maxsplit> n=<n> seed=<seed>
S: <tree1₀>
S: <tree2₀>
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
......@@ -171,9 +185,8 @@ class ZCtx(object):
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.
# XXX kill TreesSrv generates tree structures given their topology encoding on input.
@func
def TreesSrv(zstor, r):
zctx = ZCtx(zstor)
......@@ -228,7 +241,6 @@ def TreesSrv(zstor, r):
xprint("%s" % ashex(head))
# AllStructsSrv is server version of AllStructs.
@func
def AllStructsSrv(r):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment