Tagging Comments - SilverEzhik/fmtest GitHub Wiki

File tagging is not exactly an essential feature, but it is something nice to have. Just painting single files in a color and assigning tags to them is pretty easy.

Add Tags() []tag and SetTags(tags []tag) methods to File objects, then let FS modules handle the rest - local file systems can put this in a file, cloud file systems can use the available APIs or also store information locally. FS code would need to store file UID - tag relationships.

Then, a tag would be a pretty simple structure:

type tag struct {
	Name  string
	Color color.RGBA
}

But actions like filtering files by tag will get pretty complicated.

  • How to actually find files by tag?
    • Can save paths, but that would break if file is moved
    • Can save UID (inode), but that is not tied to a path or name
    • Can combine both (+ watch for file movements), but that would get complicated, and would end up requiring re-indexing the file system in many cases
  • How to keep track of existing tags?

If this is handled on FM level, then a nice thing to do would be to store the tag-file relationship, caching paths, then getting the file path by UID, if it becomes invalid (slow on local FS - have to go through the whole damn thing).

For comments, the process is basically the same - but a lot less tracking is required - just check if an UID has a comment, and you're done.