3 ms·
You can make a nice, simple (and surprisingly fast) graph database from the file system. I had to do this back in 2003 to create dynamic sites for users of a b
by sambeau 16y ago
You can make a nice, simple (and surprisingly fast) graph database from the file system.
I had to do this back in 2003 to create dynamic sites for users of a build-your-own-website app (who needed to have their data stored in their local filesystem - and they wouldn't let me use sqlite).
It turns out to be really good for expressing websites structures. The downside is that, as you can't create on-the-fly relationships, you need to either store your data in a tree that describes its use, e.g.:
blogs/2009/03/05
or you need to add links that point to the same data to create the relationships, e.g.:
blogs/2009/03/05 -> stories/a_blog_post
Obviously you can add these relationships later in much the same way as you might add indexes to a traditional database.
My system also had a notion of arrays. An index to the next auto_increment was held in a file named '.#'.
I also has a file called '.class' which would tell my object system how to process a node like this as if it was an object (each class had a a set of scripts that acted as methods).
It all worked amazingly well.
There were a couple of issues: old Solaris, I recall, used a linear search of directories so the system would crawl if a node got too big (I overcame that first with some simple a/b/c style hashing and second by upgrading Solaris) and directories were 4k each so users (who had file-usage limits) might have had grounds for complaint.