Exemplo n.º 1
0
    def crawl_keys(path):
        filelist_key = keyify(DatabaseType.FILELIST, path)
        for key in db[filelist_key]:
            if key not in db:
                continue

            item_type = key[0]

            if item_type == DatabaseType.DIRECTORY:
                crawl_keys(db[key]['virtual_path'])
        db[filelist_key] -= keys
Exemplo n.º 2
0
def crawl_all_keys_from_root(db):
    keys = set([keyify(DatabaseType.DIRECTORY, '')])
    trash_keys = set()
    def crawl_keys(path):
        filelist_key = keyify(DatabaseType.FILELIST, path)
        for key in db[filelist_key]:
            if key not in db:
                trash_keys.add(key)
                continue

            keys.add(key)
            item_type = key[0]

            if item_type == DatabaseType.DIRECTORY:
                crawl_keys(db[key]['virtual_path'])

    crawl_keys('')
    return keys, trash_keys
Exemplo n.º 3
0
def merge_all_buckets(db):
    keys = set([keyify(DatabaseType.DIRECTORY, '')])
    for bucket in generate_buckets():
        keys |= db['%s%s' % (DatabaseType.BUCKET, bucket)]
        keys |= db.get('%s%sd' % (DatabaseType.BUCKET, bucket), set())
    return keys