In July last year I made a brief post about a simple filesystem I'd put together which used Redis for the storage.
At that time I thought it was a cute hack, and didn't spend too much time with it. But recently I found a use for it so I cleaned it up, synced up the C client for Redis which I used and generally started to care again.
If it is useful you can now find it online:
The basic idea is the same as it was before, except I did eventually move to an INODE-like system. Each file/directory entry receives a unique identifier (integer) - and then I store the meta-data in a key based off that name.
This means for a file I might have keys, and values,like this:
Key | Value |
INODE:1:NAME | The name of the file (e.g. "passwd"). |
INODE:1:SIZE | The size of the file (e.g. "1661" ) |
INODE:1:GID | The group ID of the file's owner (e.g. "0") |
INODE:1:UID | The user ID of the file's owner (e.g. "0") |
INODE:1:MODE | The mode of the file (e.g. 0755) |
To store these things I use a Redis "SET" which allows me to easily iterate over all the entries in each directory.
ObQuote: "They fuck up, they get beat. We fuck up, they give us pensions. " - The Wire