So I’ve been in Deep Coding Mode™ for quite a while. What have I got to show for it?
Well, the short answer is that Insight is now a functioning file system… for a given definition of “functioning”.
As of this morning:
- It can successfully import files from the rest of the hierarchy
- Tags (i.e. directories) can be created and removed at any level.
- Tags appear and disappear more or less as you expect (i.e. if you already have a tag in your path, it won’t show up in listings again).
- Tags that are synonyms will show up as symbolic links to the actual target tag (but currently do not obey the rule in the point above, i.e. if their target has been used in the path, they may still appear).
So far, so good. Now for the limitations:
- Files cannot currently be opened, read from, written to, or deleted.
- Files must be imported in a strange manner: as absolute symbolic links. They then show up as regular files, although they are actually just links to the originals elsewhere in the filesystem.
- Tags cannot be assigned to files (or removed from them)
- Files can therefore only be imported at the root level
- Queries have no effect on file listing, and so listings just show files in limbo
- Of course, there is no subcategory union either.
But I am working on all of these things. At the moment, the main thing is sorting out the internal inode lists. Once those are done, then it should be quite straightforward to do tag assignment/removal and import directly into tags. Plan of action, therefore:
- Implement inode insertion/deletion
- Implement inode set functions (intersection, union, difference)
- Re-implement query tree builder from path. Currently only deals with building a basic conjunctive query tree and assumes that all components are tags. Should:
- Take a path
- Canonicalise it
- Check path components (left-to-right) to ensure tags exist
- If last part is an incomplete tag, treat appropriately
- If last part is a complete tag, then fine
- If last part does not resolve as a tag, then hash it and see if it translates to a known inode
- If not, or if any tags in path do not exist, then path is invalid
- If it is a valid inode, then add QUERY_IS_INODE node to tree
- Otherwise return query tree
- Implement query processing:
- Given input set of inodes, produce an output set at each node of the query tree.
- In trivial case with top-level IS_ANY node, output set is the set of limbo inodes, with internal negation flag set to false
- With an IS node, the output set is the recursive union of the inodes belonging to that tag and its subtags, with internal negation flag set to false
- With an IS_NOSUB node, the output set is the set of inodes belonging tag, with internal negation flag set to false
- With an IS_INODE node, the output set contains a single element: the inode.
- With an IS_NOT node with a subquery, the output set is identical to the subquery resultset, with an internal negation flag inverted
- With an IS_NOT node with a tag, the output set is the same as for an IS node, with an internal negation flag set to true
- An AND node output depends on the negation flags of its subqueries:
- Both false: output is the set intersection of its subqueries, with negation flag clear
- Both true: output is union of subqueries, with negation flag set
- Otherwise: output is set difference, with the negation-true set removed from the negation-false set, and the negation flag cleared
- An OR node output depends on the negation flags of its subqueries:
- Both false: output is union of subquery results, with negation flag clear
- Both true: output is intersection of subquery results, with negation flag set
- Otherwise: output is ???
- Probably very likely to be an error if the negation flag is found to be set at the top level.
- Also have to think about how to build a tree from a bracketed expression. But later. Much later.
- Output of query processing is an inode set.
- Maybe low-overhead query processing just to see if an inode would match the query?
- Implement open/read/write as pass-through operations on the inode symlink targets.
- Implement symlinking directories as creating synonyms.
- Add LOTS of checks.
- Note: also have to track inode reference count, so that when it gets to zero the inode is added to the limbo list. Once removed from there, it is removed from the filesystem completely.
These should be quite straightforward to do (I hope), especially as I know more or less exactly what I’m doing. Deadlines are closing in, however, and I have a report and presentation and demo to write yet. Hopefully I can get much of this done by Tuesday, then can spend the day doing bits of my report.
I must say that I do love developing this. It’s just so amazing to be developing a file system and see it work!
This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License.