Skip to main content

Module dependency

Module dependency 

Source
Expand description

External files a lowering read, with the fingerprint each had at the time, so a cached LowerResult can be checked against the filesystem before it is reused (issue #125).

StructsΒ§

DependencySet πŸ”’
The dependencies observed so far while lowering one document, keyed by path so a file read twice is recorded once.
ExternalDependency
One external file a lowering depended on: an #image / #figure raster or a #bibliography source.
ExternalInputs πŸ”’
What a directive lowerer needs to touch the filesystem: the .mos file paths resolve against, and the set that records every file it reads.
FileIdentity
The device and inode numbers and the status-change time of a file on Unix. Unlike the modification time, none of these can be set from userspace, so a rewrite that restores the old mtime still moves one of them. Every field is None on platforms that do not expose them.
Fingerprint
What a regular file looked like when it was read: its stat fields, the moment that stat was taken, and a fingerprint_bytes hash of its contents.

ConstantsΒ§

DOMAIN_TAG πŸ”’
RACY_WINDOW
A modification time this close to the moment the fingerprint was taken is not trusted by ExternalDependency::is_current: a second write inside the same filesystem timestamp tick would leave stat unchanged. Two seconds covers FAT’s timestamp resolution.

FunctionsΒ§

fingerprint_bytes
Fingerprint raw file bytes for dependency comparison.
fingerprint_file
The Fingerprint of the regular file at path, or None when there is no readable regular file there. Directories, devices, and pipes are never opened.
read_fingerprinted πŸ”’
Read the regular file at path and fingerprint it in one pass. The stat is taken before the read, so a write that lands between the two shows up as a changed stat on the next ExternalDependency::is_current and forces a hash comparison.
regular_file_metadata πŸ”’