Skip to main content

Module fetch

Module fetch 

Source
Expand description

First-boot model bootstrap into the shared CAS store.

Per ADR 0010 the daemon may issue outbound HTTPS for one purpose only: fetching a pinned GGUF named in ~/.inferd/config.json. Per ADR 0011 the bytes land in the shared content-addressable store at $MODELS_HOME/blobs/sha256/<aa>/<hash>/data, with a manifest written at $MODELS_HOME/manifests/<name>.json.

Producer flow:

  1. Acquire LOCK_EX on $MODELS_HOME/locks/<name>.lock.
  2. If the manifest already names a blob and that blob exists: optional re-verify, then return the blob path immediately.
  3. Otherwise stream HTTPS into $MODELS_HOME/blobs/sha256/<aa>/.partial-<hash>/data.tmp with a running SHA-256.
  4. Constant-time compare computed vs expected SHA (F-5).
  5. On match: atomic-rename into place, write manifest. On mismatch: move bad bytes into locks/quarantine/ and bail.
  6. Release the lock.

Progress events publish through a StatusBroadcaster so the admin socket can fan them out to UIs and middleware.

Structs§

ModelSpec
One downloadable GGUF model. The fetch contract is one URL + expected SHA-256; anything more elaborate (registries, mirrors) belongs in the operator’s HTTP proxy or a wget step, not here.

Enums§

FetchError
Errors produced by fetch_model.

Functions§

fetch_model
Resolve a model into its CAS blob path.