Minga.Extension.ArtifactAdmission (Minga v0.1.0)

Copy Markdown View Source

Serialized VM-generation authority for extension module provenance.

Claims remain pending through code loading and are identified by an unforgeable attempt token. Equivalent callers wait for commit or receive the next ownership token after abort; no caller can release another attempt's claim. Committed provenance is persisted by ArtifactGenerationState, so an admission-service restart never reopens an empty generation under loaded code.

Summary

Functions

Aborts only the exact pending attempt and transfers ownership to a waiting caller.

Returns a specification to start this module under a supervisor.

Atomically begins admission for every module in one validated inventory.

Atomically begins a deterministic generated or application module-set attempt.

Commits the exact pending attempt after all modules load successfully.

Marks the exact pending attempt as able to have loaded code.

Seals this VM generation against first-time source admission.

Returns the immutable source snapshot fingerprint admitted for a source.

Returns the exact committed module set admitted for a source.

Starts the VM-generation artifact admission authority.

Types

claim()

@type claim() :: %{
  source: Minga.Extension.ContributionCleanup.contribution_source(),
  fingerprint: fingerprint(),
  source_fingerprint: fingerprint(),
  modules: [module()],
  load_modules: [module()],
  adopted_modules: [module()],
  acquired?: boolean(),
  attempt_token: reference() | nil
}

collision()

@type collision() ::
  {:source_artifact_changed,
   Minga.Extension.ContributionCleanup.contribution_source()}
  | {:generation_failed, term()}
  | {:generation_sealed,
     Minga.Extension.ContributionCleanup.contribution_source()}
  | {:module_owned_by_source, module(),
     Minga.Extension.ContributionCleanup.contribution_source(),
     Minga.Extension.ContributionCleanup.contribution_source()}
  | {:module_conflicts_with_host, module()}
  | {:invalid_module_set, term()}
  | {:invalid_trusted_application, term()}
  | {:module_not_in_trusted_application, module(), atom()}

fingerprint()

@type fingerprint() :: binary()

Functions

abort_attempt(claim, opts \\ [])

@spec abort_attempt(
  claim(),
  keyword()
) :: :ok | {:error, term()}

Aborts only the exact pending attempt and transfers ownership to a waiting caller.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

claim_inventory(source, inventory, opts \\ [])

Atomically begins admission for every module in one validated inventory.

claim_source_modules(source, modules, fingerprint, opts \\ [])

@spec claim_source_modules(
  Minga.Extension.ContributionCleanup.contribution_source(),
  [module()],
  fingerprint(),
  keyword()
) :: {:ok, claim()} | {:error, collision() | term()}

Atomically begins a deterministic generated or application module-set attempt.

commit_attempt(claim, opts \\ [])

@spec commit_attempt(
  claim(),
  keyword()
) :: :ok | {:error, term()}

Commits the exact pending attempt after all modules load successfully.

mark_loading(claim, opts \\ [])

@spec mark_loading(
  claim(),
  keyword()
) :: :ok | {:error, term()}

Marks the exact pending attempt as able to have loaded code.

seal(opts \\ [])

@spec seal(keyword()) :: :ok | {:error, term()}

Seals this VM generation against first-time source admission.

source_fingerprint(source, opts \\ [])

@spec source_fingerprint(
  Minga.Extension.ContributionCleanup.contribution_source(),
  keyword()
) :: {:ok, fingerprint()} | :error

Returns the immutable source snapshot fingerprint admitted for a source.

source_modules(source, opts \\ [])

@spec source_modules(
  Minga.Extension.ContributionCleanup.contribution_source(),
  keyword()
) :: {:ok, [module()]} | :error

Returns the exact committed module set admitted for a source.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Starts the VM-generation artifact admission authority.