3 ms·
I think there is much to be learned by comparing databases and filesystems. One thing I think that filesystems can learn from databases is the notion of a comp
by im3w1l 7y ago
I think there is much to be learned by comparing databases and filesystems.
One thing I think that filesystems can learn from databases is the notion of a compound primary key. It would be neat if app-files were identified by an (app, type, id) tuple. This would bring the advantages of both the posix and the windows filesystem layouts.
For instance if we had(app=firefox, type=/usr/bin, id=main). Then we could easily find all firefox files by querying by app. Or we could easily find all binaries in PATH by querying by type.
ps. I think this would work better than the overly general tag-based filesystem people sometimes propose.
- dvirsky 7y agoWell, that's basically what directories are.
- im3w1l 7y agoThe posix filesystem layout doesn't provide an easy way of enumerate all files belonging to a given program. The traditional windows (98?) layout of one app in one folder conversely doesn't easily allow enumerating all binaries. Or all manual entries. Etc
- dvirsky 7y agoOk, so let's say you arrange your folders to acommodate for that. you have /files/$user/$program/$file. That's basically what a primary key in a database looks like. If you want a secondary index, what databases often do is just create a second table with a different primary key, with the value being primary keys of the main table. We can model that in a filesystem as well, of course. So if I want one filtering by file type and one filtering by month of creation, then I can create /files/$program/$file and then ln -s /files/$program/$file /files/month/$month/$file