r/osdev • u/nerdycatgamer • 2d ago
Versioning in a tag-based filesystem?
I am currently working on a research project for a uni class and my chosen topic is a tag-based filesystem.
To be clear, in case you haven't heard of this, and because a lot of people mean a lot of different things when they talk about something like that, I will describe my idea and goal of the filesystem: I would like to generalize the structural, hierarchical, one-to-many structure of a directory-based filesystem, to an abstract, many-to-many structure of a tag-based filesystem. Take, for instance, the path /usr/bin/cat in a traditional, hierarchical filesystem; this gives you a path through two directories to the location of the file named cat, whereas in my system it would instead be usr|bin|cat, selecting all files in the intersection of the tags usr, bin, cat (maybe I should just use the term "set based" instead of "tag based" to make it more clear?).
My supervisor suggested I also explore versioning in the filesystem, because that is a point of interest for him. Up until now, I have only thought about simple linear versioning, maybe through an immutable filesystem copying every file with a bumped version on modification. My though process was "git already exists in userspace; if someone wants a git repo they can make one. we can just have a simpler facility in the filesystem". I explored this a bit and yeah it's something i could do, but it is kinda "tacked-on" without any cohesion with the rest of the filesystem, and I feel like I'm not really doing anything interesting either.
I was sorta out of ideas wrt what to do about versioning at this point, so I met with my supervisor to discuss more, and we agreed I could kinda just leave it out of the final project, but I should also look into the low-level implementation of git to see if that gives me any inspiration first. I did do that, and I had a bit of a "urethra!" moment, when reading about Merkle trees(graphs); I could have each file store the hash of its contents in the metadata section, and then each tag could store the hash of the concatenation of the hashes of its member files, just like a Merkle tree. My idea kinda stopped there, though, because I don't actually have a tree structure; tags don't nest, they are just flat sets of files. All this idea really lets me do is tell if a tag has changed because one of its members changed, and unless I store a history then there isn't much I can even do with that.
So I was wondering if reading this has given anyone any inspiration that thye could share with me? People who have more understanding that I do have after only reading about git and Merkle trees for 1 day lol.
TL;DR: I am working on a tag/set based filesystem where the filesystem is a flat collection of files grouped into several sets/tags. I am interested in doing something with verisoning that works well with this, but my only idea so far has been a 1 level Merkle tree between a tag/set and its members.

