Expand description
The disk adapter: reads a model folder into (path, text) pairs for trumly-core. Kept apart from the core so the core never touches the filesystem.
Modules§
- library
- Where packs come from. Several places are searched and merged; the first place to have a pack’s name wins:
- pack
- Packs: folders of ordinary node files (planes, types, link types, rules) that can be added to a model.
- telemetry
- Anonymous usage data, off until the person says yes.
Functions§
- apply_
edit - Write the result of a core edit (
trumly_core::ops) into a model folder: changed nodes go where their file already is (a renamed node stays in the same folder), and the files of deleted ids are removed. Returns (written, removed). - path_
for_ id - The relative path of the file holding node
id, if there is one. - portable_
id - The stricter rule for ids of files we create. A name that works on every system and cannot be
mistaken for another: lower-case letters, digits,
-and_; starts and ends with a letter or digit; at most 100 characters; not a name Windows reserves (con,nul,com1…); and no--, which only a pack’s nodes use as a namespace separator. Files that already exist keep whatever name they have, so older models still open and save. - read_
model - Every
.mdfile underdirat any depth, as (path relative todirwith/, text). - rev_
of_ text - A revision for a file’s text: it changes whenever the text does. Used so that a writer must have seen the current version of a node before it may replace it. FNV-1a, so the same text gives the same revision everywhere.
- write_
atomically - Write a file so that nobody ever reads half of it: write beside it, then rename over it.