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

.

parent 56d07b9d
......@@ -25,8 +25,18 @@ It is primarily used to verify ΔBTail in wcfs.
- `Tree` represents a tree node.
- `Bucket` represents a bucket node.
- `StrctureOf` returns internal structure of a BTree represented as Tree and
Bucket nodes.
- `Restructure` XXX
- GenStructs
Topology encoding
-----------------
XXX Typology:
- TopoEncode XXX
- TopoDecode
"""
from __future__ import print_function, absolute_import
......@@ -72,7 +82,7 @@ class Tree:
#def __repr__(t):
# return 'R'+str(t)
# TODO def dot() -> str for graphviz
# TODO def graphviz() -> str for graphviz
# TODO def TopoEncode() -> str with topology encoding
# TODO @staticmethod def TopoDecode(in) <- Tree from topology string
......@@ -98,7 +108,9 @@ class Bucket:
__repr__ = __str__
# StructureOf returns internal structure of a tree.
# StructureOf returns internal structure of a BTree.
#
# The structure is represented as Tree and Bucket nodes.
def StructureOf(node):
typ = type(node)
is_tree = ("Tree" in typ.__name__)
......@@ -184,10 +196,13 @@ def AllStructs(keys, maxdepth, maxsplit): # -> i[] of Tree
def _allStructs(klo, khi, keyv, maxdepth, maxsplit):
assert klo <= khi
# XXX assert keyv sorted, in [klo, khi)
_assertIncv(keyv)
if len(keyv) > 0:
assert klo <= keyv[0]
assert keyv[-1] < khi
print('_allStructs [%s, %s) keyv: %r, maxdepth=%d, maxsplit=%d' %
(klo, khi, keyv, maxdepth, maxsplit))
#print('_allStructs [%s, %s) keyv: %r, maxdepth=%d, maxsplit=%d' %
# (klo, khi, keyv, maxdepth, maxsplit))
for nsplit in range(0, maxsplit+1):
for ksplitv in _iterSplitByN(klo, khi, nsplit):
......
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