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