Expand description
The resource cache: the names the generated and copied resources of one destination directory take, kept across the split pages of a run and across runs into the same directory.
Port of the part of Perl’s document cache the resource names live in (crate::document::DocCache, persisted as
crate::document::CACHE_FILE in the destination directory): generateResourcePathname‘s counter under
_max_<subdir>_<prefix>_counter_ (Post.pm L192-200) and Graphics’ key → "dest|w|h" entries
(Post/Graphics.pm L245-262, L331). A name’s owner is its source (path relative to the destination directory,
page, crop and turn, type; a size only where a vector render’s root carries it, OD #1034), as a Perl key is: our
entries _owner_<name>, _name_<owner> and _source_<name> keep it, and _holds_<name> the bytes the name was
last written with, so an edited image is a new key (the content digest replaces Perl’s timestamp check) written
again into the name its source owns.
_content_<bytes> lets a source with the same bytes share that file while its owner is named in the same run with
them (the pages of one document); another document’s file is never shared, as that document may write other bytes
into it later, under a page this run does not rewrite. A copy keeping its path shares none (Perl L289-300).
Divergences (OXIDIZED_DESIGN_DIVERGENCES #1157): an entry stores the name only (Perl’s width and height let it skip
a conversion, which the content-addressed graphics_cache serves here); a converted or generated name is kept
across an edit (Perl generates a new xN); a kept name (a copy’s relative path, a converted image’s stem) another
source owns falls back to a generated xN, where Perl overwrote it (issue 995); and a stored name is written only
when the request could have been given it (Checks). Each resolve is one IMMEDIATE transaction, so
processes naming into one folder at once through the file never hand out one name to two sources. A name new to the
store is never given over a file in the folder the request may not write (Checks::on_disk): with the store on
its file (a new one too, made where a cache was deleted) any file it does not own; in memory in place of its file
(it could not be opened, or the transaction failed and runs again there) a file holding other bytes than the request
writes, so a rerun takes its own files again. One that could not copy the file’s entries does not know a file’s
owner: a file of another document holding the same bytes is taken as the request’s own (OD #1157 (10)).
Structs§
- Checks
- What the caller knows of the destination directory.
- Request
- One resource to name.
- Resolved
- How a request was named.
- Resource
Name - A resource’s destination, relative to the destination directory, and its vector render’s when it may have one.
Enums§
- Output
- What a resource’s file will hold, so that a store in memory tells the file an earlier run wrote for it.
- Proposal
- What a resource’s name is first tried as.
Functions§
- counter_
key - The counter Perl’s
generateResourcePathnamekeeps forprefix(Post.pmL194-196; noresource_directory). - resolve
- Name every request, page by page, on
conn(in the caller’sIMMEDIATEtransaction): a name stored for its key, its source or its content, else, within a page, the copies that keep their path first, then the conversions, then the copies that take a generated name, each in node order (the order the page’s names were handed out in before).
Type Aliases§
- OnDisk
- Whether a file of the name exists in the destination directory that the request may not write (
Checks::on_disk).