Add (disabled) code to test sort order

This commit is contained in:
Elliot Nunn 2018-10-14 09:11:09 +08:00
parent 968fdadf2b
commit ac4bedcf53
1 changed files with 6 additions and 0 deletions

View File

@ -135,6 +135,7 @@ class Volume(directory.AbstractFolder):
cnids = {}
childlist = [] # list of (parent_cnid, child_name, child_object) tuples
prev_key = None
for rec in btree.dump_btree(extrec2bytes(drCTExtRec)):
# create a directory tree from the catalog file
rec_len = rec[0]
@ -143,6 +144,11 @@ class Volume(directory.AbstractFolder):
key = rec[2:1+rec_len]
val = rec[bitmanip.pad_up(1+rec_len, 2):]
# if prev_key: # Uncomment this to test the sort order with 20% performance cost!
# if _catalog_rec_sort((prev_key,)) >= _catalog_rec_sort((key,)):
# raise ValueError('Sort error: %r, %r' % (prev_key, key))
# prev_key = key
ckrParID, namelen = struct.unpack_from('>LB', key)
ckrCName = key[5:5+namelen]