Fetches model artefacts and places them under a priv directory. Used by
Mix.Tasks.Compile.BbInference, which supplies the directories.
The cache
URL sources are downloaded once into a cache outside the project, keyed by the URL's own SHA-256, and reused by every project and every build that declares the same URL. An archive is cached whole and the member extracted from it each time it is placed.
Outcomes
- Placed - the artefact is in
privand, where asha256is declared, matches it. - Warning - the download failed. Nothing is placed and nothing is recorded, so the next build tries again.
- Error - the artefact doesn't match its declared
sha256, the local source doesn't exist, or the archive doesn't contain the member. A download that doesn't match is deleted from the cache, so the next build downloads it again rather than failing on the same bytes.
Not re-hashing
The manifest records, for each placed artefact, what was declared and the size and modification time of the file placed. An artefact whose declaration and file are both unchanged is not hashed again.
Summary
Functions
Place every artefact, returning what was said about each and the new manifest.
Types
Functions
@spec place_all([{module(), artefact()}], options()) :: {[diagnostic()], manifest()}
Place every artefact, returning what was said about each and the new manifest.
Files under priv_dir that the old manifest placed and that no artefact
now declares are removed.