GeoGenius.Pipeline.Artifacts (geo_genius v0.2.0)

Copy Markdown View Source

The import phases that obtain a release's files: download/1 and validate/1.

This is the only part of the pipeline that touches the cache, the downloader, or a checksum. Every artifact is resolved the same way -- look in the cache first, download a miss, hash whatever came back, and record that observation -- so a cached copy and a fresh download reach record_artifact_observation/5 through the same check.

A cache hit is hashed on every run, including one whose artifact row already carries a validated_at. Trusting that column would mean a corrupted or swapped cache entry is never noticed again: every later run would import it, and the release it produced would pass verification on bytes nobody reviewed.

Summary

Functions

Resolves every artifact the release composes to a local file, recording what each one hashed to.

Checks that every required artifact carries a validated_at, and counts the optional ones nothing could obtain.

Functions

download(state)

Resolves every artifact the release composes to a local file, recording what each one hashed to.

Measures "artifacts", "downloaded", "cached", and "bytes", and carries each artifact's local path and attributed source release forward on the state.

validate(state)

Checks that every required artifact carries a validated_at, and counts the optional ones nothing could obtain.

Re-reads the artifacts rather than trusting what download/1 collected: validated_at is set by PostgreSQL, and reading it back is what makes this a check rather than a restatement of what the previous phase believed.