Skip to content

Instantly share code, notes, and snippets.

@mikermcneil
Last active August 29, 2015 14:04
Show Gist options
  • Save mikermcneil/a8551ca652d31c0e12aa to your computer and use it in GitHub Desktop.
Save mikermcneil/a8551ca652d31c0e12aa to your computer and use it in GitHub Desktop.
So... what's a filesystem?

On Filesystems

So... what's a filesystem?

According to wikipedia:

In computing, a file system (or filesystem) is used to control how data is stored and retrieved. Without a file system, information placed in a storage area would be one large body of data with no way to tell where one piece of information stops and the next begins. By separating the data into individual pieces, and giving each piece a name, the information is easily separated and identified. Taking its name from the way paper-based information systems are named, each piece of data is called a "file". The structure and logic rules used to manage the groups of information and their names is called a "file system".

While all that is true, it's not quite what I'm looking for, nor particularly useful as a lemma in the grand unified theory of computer science we're reluctantly building in the Node.js community.

I thought about this a bit and came up with some ideas. Here's my take:

  • A filesystem is a key/value database (like Redis) but optimized for storing large binary values (aka "files") with conventionally-named keys (aka "paths")
  • By convention, keys are prefixed with '/'. Most of the time they also end with ".*" where * is a short alphanumeric suffix.
  • Filesystems are optimized to support a concept of "directories" or "folders" which represent a grouping of keys based on shortest prefix (i.e. "/foo/bar/baz.jpg" and "/foo/bar/blah.png" are in the same "directory) Directories don't really exist, but these '/' characters do have special meaning
  • Filesystems sometimes also store metadata for performance reasons, or to provide additional features like permissions and indexed search. A common example is the size (in bytes) of various files, and/or even the calculated size of "directories"
@mikermcneil
Copy link
Author

Thanks for the comments guys :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment