gleamunison/manifest

Package manifests: the unit of distribution.

A manifest is pure data: name, version, the definition hashes it contains, the manifests it depends on, and whether installation must see passing-test evidence for every definition. The manifest is itself content-addressed and stored in the DAG — the DAG is the registry; there is no server, no mutable name→version table, no latest.

Types

pub type Manifest {
  Manifest(
    name: String,
    version: String,
    defs: List(ManifestDef),
    deps: List(String),
    require_evidence: Bool,
    format_version: Int,
  )
}

Constructors

  • Manifest(
      name: String,
      version: String,
      defs: List(ManifestDef),
      deps: List(String),
      require_evidence: Bool,
      format_version: Int,
    )

    Arguments

    deps

    Hex hashes of manifests this package depends on.

    format_version

    1 is the legacy name=hash format; 2 carries effectful per-def flags.

pub type ManifestDef {
  ManifestDef(name: String, hash_hex: String, effectful: Bool)
}

Constructors

  • ManifestDef(name: String, hash_hex: String, effectful: Bool)

Values

pub fn add_def_with_effect(
  m: Manifest,
  name: String,
  hash_hex: String,
  effectful: Bool,
) -> Manifest
pub fn def_effectful(def: ManifestDef) -> Bool
pub fn def_hash(def: ManifestDef) -> String
pub fn def_name(def: ManifestDef) -> String
pub fn fetch(
  adapter: storage.StorageAdapter,
  ref: identity.DefinitionRef,
) -> Result(Manifest, String)

Fetch a manifest by ref. The stored bytes re-hash to the requested ref or the fetch fails: integrity is structural, not trusted.

pub fn hash_of(m: Manifest) -> identity.Hash

Content hash over the canonical form: same contents, same hash, regardless of the order defs were added in.

pub fn new(name: String, version: String) -> Manifest
pub fn parse(text: String) -> Result(Manifest, String)

Parse current manifests and the original name=hash format. Legacy entries deliberately become pure: absent metadata never grants Io admission.

pub fn ref_from_hex(
  hex: String,
) -> Result(identity.DefinitionRef, String)

A ref from a hex string (what a user pastes into pkg install).

pub fn ref_of(m: Manifest) -> identity.DefinitionRef

The ref this manifest is stored under.

pub fn serialize(m: Manifest) -> String

Serialize using the format version carried by the value. This preserves the hash of legacy manifests loaded from the store.

pub fn store(
  adapter: storage.StorageAdapter,
  m: Manifest,
) -> Result(identity.DefinitionRef, String)

Store the manifest in the DAG under its content hash. Returns the ref.

✨ Search Document