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(#(String, String)),
    deps: List(String),
    require_evidence: Bool,
  )
}

Constructors

  • Manifest(
      name: String,
      version: String,
      defs: List(#(String, String)),
      deps: List(String),
      require_evidence: Bool,
    )

    Arguments

    defs

    (definition name, hash hex) pairs; hashing/serialization are canonical (sorted), so order in this list is presentation only.

    deps

    Hex hashes of manifests this package depends on.

Values

pub fn add_def(
  m: Manifest,
  name: String,
  hash_hex: String,
) -> Manifest
pub fn add_dep(
  m: Manifest,
  manifest_hash_hex: String,
) -> Manifest
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 a manifest back from its canonical text form.

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

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

pub fn ref_hex_of(ref: identity.DefinitionRef) -> String

The hex form of a ref — the shareable name of a manifest.

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

The ref this manifest is stored under.

pub fn serialize(m: Manifest) -> String

Canonical text serialization — what gets stored in the DAG.

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.

pub fn without_evidence_requirement(m: Manifest) -> Manifest
✨ Search Document