Spectre.Stack.Definition (Spectre v0.3.0)

Copy Markdown View Source

Compiled, immutable environment installed for an Agent.

Definitions validate package compatibility, dependency ordering, ownership, and capability collisions. They contain logical configuration only.

Summary

Functions

Fetches the compiled definition exposed by a Stack module.

Fetches a Stack definition or raises.

Returns a package installation by its local installation identifier.

Returns the portable manifest for inspection, contract tests, and tooling.

Resolves a closed logical capability to a fenced Spectre.Stack.Ref.

Revalidates every invariant and digest in a compiled definition.

Revalidates a compiled definition or raises.

Types

capability_kind()

@type capability_kind() ::
  :package | :contract | :service | :operation | :action | :resource

t()

@type t() :: %Spectre.Stack.Definition{
  contract: pos_integer(),
  digest: String.t() | nil,
  id: term(),
  index: %{
    optional({capability_kind(), term()}) => Spectre.Stack.Installation.t()
  },
  installations: [Spectre.Stack.Installation.t()],
  owner: module(),
  packages: %{optional(term()) => Spectre.Stack.Package.t()},
  version: pos_integer()
}

Functions

fetch(stack)

@spec fetch(module()) :: {:ok, t()} | {:error, term()}

Fetches the compiled definition exposed by a Stack module.

fetch!(stack)

@spec fetch!(module()) :: t()

Fetches a Stack definition or raises.

installation(stack, id)

@spec installation(t() | module(), term()) ::
  {:ok, Spectre.Stack.Installation.t()} | {:error, term()}

Returns a package installation by its local installation identifier.

manifest(stack)

@spec manifest(t() | module()) :: map()

Returns the portable manifest for inspection, contract tests, and tooling.

resolve(stack, kind, id)

@spec resolve(t() | module(), capability_kind(), term()) ::
  {:ok, Spectre.Stack.Ref.t()} | {:error, term()}

Resolves a closed logical capability to a fenced Spectre.Stack.Ref.

validate(definition)

@spec validate(t()) :: {:ok, t()} | {:error, term()}

Revalidates every invariant and digest in a compiled definition.

validate!(definition)

@spec validate!(t()) :: t()

Revalidates a compiled definition or raises.