Mailglass.Installer.Manifest (Mailglass v1.0.0)

Copy Markdown View Source

.mailglass.toml manifest helpers for deterministic installer reruns.

Summary

Functions

Returns the default manifest path.

Computes a deterministic SHA-256 hash for any binary content.

Loads a manifest from disk. Missing files return an empty manifest.

Returns a new in-memory manifest shape.

Returns a previously tracked hash for path.

Inserts or updates a tracked path hash in memory.

Updates installer version and operation timestamp in memory.

Writes a manifest to disk in deterministic order.

Types

t()

@type t() :: %{
  installer_version: String.t(),
  last_run_at: String.t() | nil,
  paths: %{optional(String.t()) => String.t()}
}

Functions

default_path()

@spec default_path() :: String.t()

Returns the default manifest path.

hash(contents)

@spec hash(binary()) :: String.t()

Computes a deterministic SHA-256 hash for any binary content.

load(path \\ ".mailglass.toml")

@spec load(String.t()) :: {:ok, t()} | {:error, term()}

Loads a manifest from disk. Missing files return an empty manifest.

new()

@spec new() :: t()

Returns a new in-memory manifest shape.

path_hash(map, path)

@spec path_hash(t(), String.t()) :: String.t() | nil

Returns a previously tracked hash for path.

put_hash(manifest, path, path_hash)

@spec put_hash(t(), String.t(), String.t()) :: t()

Inserts or updates a tracked path hash in memory.

with_run_metadata(manifest, opts \\ [])

@spec with_run_metadata(
  t(),
  keyword()
) :: t()

Updates installer version and operation timestamp in memory.

write(manifest, path \\ ".mailglass.toml")

@spec write(t(), String.t()) :: :ok | {:error, term()}

Writes a manifest to disk in deterministic order.