Implementing a VFS

While trying to implement a Virtual File System, that is to say a virtual representation of an hard drive with its folders and files, there are two main approach to consider:
- a tree based approach
- an absolute parent path approach

In the tree based approach, everything is a node, a node has a name (i.e. the name of a folder or file) and a parent folder identified by an ID.

In the absolute parent path approach, we consider both the name of the element, and the full path leading to the folder containing it.

Both have their pros and cons.
Tree based approach allow to change the name of a node, and to move it with a single SQL query. But fetching the content of a folder given its path requires to first found the ID of the folder, by advancing one node by onde node, same with getting the full path of a node.

Absolute parent path is the exact opposite, search queries are easy, but changing the name of a folder or moving it might require several update queries.

For my part I am working on an hybrid approach: the VFS is represented using a tree based approach in the main database, and a secondary database, search oriented, is kept up to date following changes made to the first one.