Expand description
Bundled plugins on disk: a bundled plugin’s files live in the binary, but a backend or a
script tool needs them as files a process can run. materialize writes them once to a
versioned cache folder, <root>/<id>-<byob version>-<content hash>/, and returns it.
- The folder name changes whenever the files or byob’s version do, so a folder that exists is complete and current: it is written under a temporary name and renamed into place (two byob processes racing both end up with the same folder).
- Its files are made read-only: edits belong in a fork (
keep_plugin), not here. Python may still add__pycache__. - Older folders of the same plugin are removed when a new one is made, once nothing has
used them for
PRUNE_AFTER(another byob, of another version, may be running from one): every use stamps the folder (USED).
Constants§
- MARKER
- What marks a materialized folder (and holds its hash).
- PRUNE_
AFTER - An older folder unused this long is removed.
- USED
- Touched whenever a byob uses the folder.
Functions§
- content_
hash - FNV-1a over the files (path, NUL, text, NUL), stable across runs.
- folder
- The folder
id’s files go to underrootfor this byobversion. - materialize
- Write plugin
id’sfilesunderroot(if not there yet) and return the folder.