add a tagging system to the website

This commit is contained in:
りき萌 2025-08-24 13:18:51 +02:00
parent 701da6bc4b
commit e1b6578b2a
97 changed files with 1025 additions and 979 deletions

View file

@ -1,4 +1,6 @@
%% title = "composable virtual file systems"
%% id = "b?01JDJJSEWASRWJGKMBNYMFD9B5"
title = "composable virtual file systems"
tags = ["programming", "treehouse"]
% id = "01JDJGVC7BRZDSYTZCH0S357B8"
- you know what I hate?
@ -92,7 +94,7 @@ like... you know. a _virtual_ file system?
% id = "01JDJGVC7BPEW2NAT7XSB5F97E"
- first of all, from the perspective of the program, do we _really_ need to differentiate between directories and files?
% id = "01JDJGVC7BHQWZDS17DY0096F6"
- from a GUI design standpoint, they're a useful abstraction for us humans---the more concrete an object, the easier it is to grasp.
_files_ and _folders_ seem a lot more easy to grasp than abstract _entries_ which _may_ represent documents, folders, or both.
@ -201,7 +203,7 @@ like... you know. a _virtual_ file system?
% id = "01JDJGVC7BQZAY4TP1WG5N6QR3"
- having a design in mind, I thought it would be interesting to integrate it into a real project.
the treehouse seemed like the right thing to test it out on, since it's effectively a compiler---it transforms a set of source directories into a target directory.
% id = "01JDJH59SN5219QPGJPZS7FMA6"
- and I have to say: so far, I'm liking it!
@ -339,23 +341,23 @@ like... you know. a _virtual_ file system?
`Edit`s take many shapes and forms, but the most important one for us is `Write`: it allows you to write a file to the disk.
the other ones are for composing `Edit`s together into larger ones.
% id = "01JDJGVC7BCT46CXXVKMXATAA3"
- `Seq` can be used to implement transactions, where all edits have to succeed for the parent edit to be considered successful.
% id = "01JDJHDZ8XWEZAA94AW1VS4P53"
- I use this for writing backups.
if writing a backup fails, we wouldn't want to overwrite the original file, because we wouldn't be able to restore it!
% id = "01JDJGVC7B05H6079QHXAXC8Y4"
- `All` can be used to aggregate independent edits together and execute them in parallel.
% id = "01JDJGVC7BKXXJSWYTGX7XA979"
- `Dry` can be used to implement a `--dry-run` command, only printing an edit instead of applying it.
% id = "01JDJGVC7B7MNC3CA5DEP1HXM6"
+ `NoOp` can be used when you need to produce an `Edit`, but don't actually want to perform any operations.
% id = "01JDJGVC7BJRSMS1E4NQRVZ1H2"
- this runs contrary to [my opinion on `None` enums][branch:01HCG7KTGGAFS07QYJXZG6WHJJ], for one reason: would you rather have to handle `Option<Edit>` everywhere, or just assume whatever `Edit` you're being passed is valid?
@ -373,7 +375,7 @@ like... you know. a _virtual_ file system?
% id = "01JDJGVC7BGJQXTVZ6Z9BK12BG"
- of course then you cannot create directories.
% id = "01JDJGVC7B2JTWKJVEE1VP6P68"
- also, [TOCTOU](https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use) bugs are a thing, but I disregard those as they don't really fit into a compiler's threat model.
@ -389,7 +391,7 @@ like... you know. a _virtual_ file system?
% id = "01JDJGVC7BCG0W3SWSYR647ZCC"
- `TreehouseDir` is a file system which renders `.tree` files into HTML lazily.
% id = "01JDJGVC7BBJCR1TQCBKBHMBNS"
- since generating all this HTML is an expensive operation, I have it wrapped in a `ContentCache` adapter, which caches any successfully generated pages in memory.
@ -452,7 +454,7 @@ like... you know. a _virtual_ file system?
% id = "01JDJGVC7BVV81GF2GRTQVCK7E"
- there is one flaw I want to point out with the current implementation of `Dir`: it uses trait methods to add new resource forks.
% id = "01JDJGVC7BJS79G1VJN1G29GRK"
- any time you add a new resource fork that's implemented only by one or two `Dir`s, you have to duplicate a stub across all existing adapters!
this means introducing a new fork means performing up to `N` edits, where `N` is the number of implementers of `Dir`.