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

.

parent 0992814c
...@@ -84,6 +84,11 @@ def treedeltaGenAllStructs(zstor, kv1txt, kv2txt, n): ...@@ -84,6 +84,11 @@ def treedeltaGenAllStructs(zstor, kv1txt, kv2txt, n):
zconn = db.open(); defer(zconn.close) zconn = db.open(); defer(zconn.close)
root = zconn.root() root = zconn.root()
seed = int(time.now())
print("# seed=%d" % seed)
random.seed(seed)
# root['treedelta/values'] = {} v -> ZBlk(v) # root['treedelta/values'] = {} v -> ZBlk(v)
valdict = root.setdefault('treedelta/values', {}) valdict = root.setdefault('treedelta/values', {})
for v in b'abcdefghi': for v in b'abcdefghi':
...@@ -111,15 +116,15 @@ def treedeltaGenAllStructs(zstor, kv1txt, kv2txt, n): ...@@ -111,15 +116,15 @@ def treedeltaGenAllStructs(zstor, kv1txt, kv2txt, n):
maxdepth=2 # XXX -> 3? maxdepth=2 # XXX -> 3?
maxsplit=1 # XXX -> 2? maxsplit=1 # XXX -> 2?
t1structs = list(xbtree.AllStructs(kv1.keys(), maxdepth, maxsplit)) t1AllStructs = list(xbtree.AllStructs(kv1.keys(), maxdepth, maxsplit))
t2structs = list(xbtree.AllStructs(kv2.keys(), maxdepth, maxsplit)) t2AllStructs = list(xbtree.AllStructs(kv2.keys(), maxdepth, maxsplit))
# emit initial kv1 state prepared as ZODB would natively # emit initial kv1 state prepared as ZODB would natively
ztree = valdict['treedelta/tree'] = XLOTree() ztree = valdict['treedelta/tree'] = XLOTree()
for k in sorted(kv1): for k in sorted(kv1):
ztree[k] = kv1[k] ztree[k] = kv1[k]
transaction.commit() transaction.commit()
# XXX print # XXX print txnδ
t1struct0 = xbtree.StructureOf(ztree) t1struct0 = xbtree.StructureOf(ztree)
# emit initial kv2 state prepared as ZODB would natively # emit initial kv2 state prepared as ZODB would natively
...@@ -129,9 +134,18 @@ def treedeltaGenAllStructs(zstor, kv1txt, kv2txt, n): ...@@ -129,9 +134,18 @@ def treedeltaGenAllStructs(zstor, kv1txt, kv2txt, n):
else: else:
ztree[k] = v ztree[k] = v
transaction.commit() transaction.commit()
# XXX print # XXX printδ
t2struct0 = xbtree.StructureOf(ztree) 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 @func
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