Commit 3f165269 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 11fd47a9
...@@ -157,6 +157,7 @@ def Trees(zstor, r): ...@@ -157,6 +157,7 @@ def Trees(zstor, r):
xprint("start @%s root=%s" % (ashex(head), ashex(ztree._p_oid))) xprint("start @%s root=%s" % (ashex(head), ashex(ztree._p_oid)))
treetxtPrev = zctx.ztreetxt(ztree) treetxtPrev = zctx.ztreetxt(ztree)
# XXX dup wrt AllStructsSrv
while 1: while 1:
treetxt = r.readline() treetxt = r.readline()
if treetxt == '': if treetxt == '':
...@@ -273,6 +274,18 @@ def AllStructs(zstor, kv1txt, kv2txt, n, seed=None): ...@@ -273,6 +274,18 @@ def AllStructs(zstor, kv1txt, kv2txt, n, seed=None):
emit(delta, verify, tstruct) emit(delta, verify, tstruct)
""" """
# XXX
@func
def AllStructsSrv(r):
# XXX dup wrt Trees
while 1:
req = r.readline()
if req == '':
break # EOF
req = req.rstrip() # trim trailing \n
if req.startswith('#'):
continue # skip comments
# AllStructs generates topologies for subset of all possible tree changes in # AllStructs generates topologies for subset of all possible tree changes in
# between kv1 and kv2. See top-level documentation for details. # between kv1 and kv2. See top-level documentation for details.
@func @func
...@@ -459,6 +472,13 @@ def cmd_allstructs(argv): ...@@ -459,6 +472,13 @@ def cmd_allstructs(argv):
seed = os.environ.get("treegen_SEED") seed = os.environ.get("treegen_SEED")
AllStructs(kv1, kv2, maxdepth, maxsplit, n, seed) AllStructs(kv1, kv2, maxdepth, maxsplit, n, seed)
@func
def cmd_allstructs_srv(argv):
if len(argv) != 1:
print("Usage: cat requests |treegen allstructs.srv", file=sys.stderr)
sys.exit(1)
AllStructsSrv(sys.stdin)
@func @func
def cmd_trees(argv): def cmd_trees(argv):
if len(argv) != 1: if len(argv) != 1:
...@@ -478,8 +498,9 @@ def xprint(msg): ...@@ -478,8 +498,9 @@ def xprint(msg):
cmdRegistry = { cmdRegistry = {
'allstructs': cmd_allstructs, 'allstructs': cmd_allstructs,
'trees': cmd_trees, 'allstructs_srv': cmd_allstructs_srv,
'trees': cmd_trees,
} }
def main(): def main():
......
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