📜 ⬆️ ⬇️

How to make tagged FS user-friendly

Inspired by this topic, I decided to figure out what a tagged file system should be in order to use it fully. As noted in the article, for implementation, it is enough to create shortcuts to the same file in folders corresponding to different tags. It remains to do normal usability, so that this function can be used. This article is a kind of technical task, highlighting the tag storage mechanism, as well as the possibility of working with them from the file manager and from the console. Perhaps in the future someone will take up its implementation. Maybe I will.


Presentation of information


Our virtual system is stored in its root folder, which is a regular folder in a regular file system (for example, / tagfs). All the addresses below are inside this folder. The service information of our file system is stored in a separate folder (/.fs/).

Each file has a list of tags. If some files are marked with the tag "tag1", the folder / tag1 is created in the root folder, links to the corresponding files are put into it.
')
For a file, you can also specify a hierarchical tag, for example, “programs / python”. To store it, the folder / programs / python will be created, and files can be found both by the “programs” tag and by the “python” tag. This will keep the tags in order, rather than putting them in one pile.

Physically, the file is stored where indicated by the first tag in the list. Thus, specifying the “video” tag as the first tag, we will force the system to put the file in the / video folder into which you can mount a large disk.

It is possible to add a folder so that its internal contents are not affected by the tag system. This may be, for example, the source folder of a program for which a hierarchical structure is necessary.

To simplify understanding, we systematize:

Types of files:


Types of folders:


Work through the file manager


In the address bar, you can type a list of tags and get a list of files with these tags. This list may contain files with the same name. It is possible to remove a tag from the condition with one click (some red cross). When you enter a tag, autocompletion should work, and indeed you can not enter the tag, but choose from the list (sorted by frequency of use). When you enter one tag, you should see a list of folders corresponding to the tags attached to it.

In the properties of a file or folder, you can specify a list of tags. If the file or folder is outside the folder of the tag file system, then when you specify the tag, they will be moved. For a folder, you can choose whether to save its hierarchical structure (otherwise, all attached files will be marked with the specified tags and moved to one place). If you delete all tags from the list, you will have to select the folder to save the file - a file without tags cannot be stored in the scope of our file system.

You can also set a logical condition of the operators "and", "or", "not" and brackets. If you create a file in the search results, it will be marked with appropriate tags; If the search was based on a logical expression, a dialog opens to select the desired tags. In the context menu of the file there should be the item “Open files by the main tag”, if we are not in the folder of the corresponding main tag. Creating a folder creates a hierarchical folder. To create a tag instead of a folder, it is enough to specify it in the list of tags of a file.

When copying a file from the outside to the tag area, a tag corresponding to the destination folder is automatically assigned to the file. When copying a folder, by default it is added entirely with preservation of the hierarchical structure.

Work through the console


For our system, full-fledged work through the console should be implemented. Obviously, using standard filesystem tools, you can navigate through folders and work with files corresponding to these tag folders. You need to be able to write something like “cd tag1 and tag2” and go to the virtual folder containing the results of the issue, see their list with the ls command. There should be a utility for viewing and editing the list of tags for a file, a command for switching to the main tag folder of the specified file, a command for copying the list of tags of one file into tags of another.

Source: https://habr.com/ru/post/81352/


All Articles