build and maintain a tree from the sublevels in a leveldb instance