Efficient directory tree-like data structure for virtual file system?
I've already ben able to compress and encrypt each individual file using LZ4 and AES but I need to store the tree information so I was thinking maybe to have a hash table of descriptors, where each entry would have the following information:
- Position (in the binary container)
- Size (to be able read only the bytes for that particular file)
- Type (whether it's a directory or a file)
- Next sibling
Also, if each hash is computed from the full path in the original directory, extracting a single file would require only a binary search. But for traversing a directory or extracting multiple files, the fields for parent and next sibling in the descriptor could be used instead, so no more binary searches are needed after the first descriptor is returned from the hash table.