gleamunison/pkg
Package installation: the registry’s read path.
install_from_store composes the three shipped pieces: manifest fetch (integrity re-hashed), the evidence turnstile (no passing test on the content hash, no install), and the versioned namespace (bindings land as a commit on the target branch — causal history included).
v2: manifest deps install recursively (cycle-safe — a manifest is
installed once per install, even under repeated or cyclic dep edges).
Peer fetching is the CLI’s job: manifest_closure computes exactly
the ref set a peer transfer needs, so sync moves the closure, not
the universe.
Types
Values
pub fn install_from_store(
adapter: storage.StorageAdapter,
manifest_hex: String,
branch: String,
) -> Result(List(String), String)
Install a package from the local store onto a branch. Deps install first, recursively; each manifest in the graph installs once even under cyclic or repeated dep edges. Returns every admitted definition name (deps first). Refuses (Error naming the unevidenced defs) when a gated manifest lacks passing Test attestation.
pub fn manifest_closure(
adapter: storage.StorageAdapter,
root_hex: String,
) -> Result(Closure, String)
Walk the dep graph from a root manifest hash, collecting manifests and def hashes. Cycle-safe: visited manifests are never re-entered.
pub fn publish_to_store(
adapter: storage.StorageAdapter,
defs: List(#(String, String, Bool)),
name: String,
version: String,
) -> Result(String, List(String))
Publish #(name, hash, effectful) triples as a manifest in the DAG. The turnstile runs first with the real flags: pure defs need passing-test evidence, effectful defs may carry Io attestation. Any unevidenced def refuses the whole publish (Error names them). Success stores the manifest (name+hash only — effect flags are a filed follow-up) and returns its hex: the shareable name of the package.
pub fn pull_closure(
adapter: storage.StorageAdapter,
root_hex: String,
fetch_batch: fn(List(String)) -> Result(Nil, String),
) -> Result(Closure, String)
Pull exactly a package’s closure through fetch_batch (a transport
that fetches ref hexes into the local adapter). Manifests are walked
iteratively — dep manifests only become readable once they land —
then missing def chunks are fetched in one batch. Returns the
closure that was transferred.