by jxy · 8y ago · 0 comments
The idea of flat text files sounds odd, when you can have structured S-exp's.
Now consider that anything that consumes a seekable byte-buffer as its backing store could just-as-well be modified to consume a block device as its backing store.
Voila: your OS now has “durable memory” in place of a filesystem.
(And, in fact, in modern systems you can skip the whole block-device layer and just sit your tuple store directly on top of NVMe.)
A filesystem is effectively a hierarchical model database with a very limited feature set (usually no transactions, minimal or no schema enforcement, very limited query language.)
Why not add some of those features?
Filesystem transactions: Windows supports them, but Microsoft has deprecated them; part of the reason, I think, is transactions required use of a different API to access files, which meant almost nobody used them; if they had been accessible through the same filesystem API as non-transactional operations, they might have seen more adoption.
Schema enforcement: I could create a directory called "images", and then specify that all files in images have to be of MIME type image/*, and the FS will refuse to let me put a text file or executable in there. I could have a directory called "logs", and require all file names in that directory to have names containing a valid date/timestamp. I could enforce the rule that a .json file has to contain well-formed JSON, or a .xml file must contain well-formed XML.
Querying: filesystem could support SQL queries over file extended attributes. (It doesn't have to be SQL, SQL syntax is pretty ugly.) "Find all files of MIME type image/png which are greater than 100KB in size?" "How many executable files are there? How much space do they consume?"
yeah, that's what a lot of people wondered in the 70s too and it failed spectacularly, and failed again spectacularly in the 2000s with microsoft's WinFS.
http://neilrieck.net/docs/openvms_notes_rms_rdb.html
https://en.m.wikipedia.org/wiki/Be_File_System
Even aliases aren't well thought out, at least on Windows. No automatic updating if the name changes, no "find folders that contain an alias to this one", etc.
Don't get me started on versioning. Apple's Time Machine is a decent interface, but it's solving a different sort of problem.
Journaling file systems all have transactions, do you want to run multiple actions in the same transaction? that'd be neat.
> Schema enforcement
How would the database know that a blob of bytes is an image or an xml file? Will you need to implement heuristics for every possible file type, or do users establish the type of the file? if the later, what's the point?
> Querying
unix `find` can do that. It's also pretty ugly
Sounds pretty much like a filesystem to me. Isn't this basically what Linux already does?
[1] https://github.com/robert-strandh/LispOS
[2] https://github.com/robert-strandh/LispOS/blob/master/Documen...
[3] https://github.com/robert-strandh/LispOS/blob/master/Documen...
If an OS is an exclusive environment for a single language, then that language's abstractions for handling data could be pushed much deeper than we're used to.