Continuum.VersionRegistry (continuum v0.5.0)

Copy Markdown View Source

Registry for workflow version hashes and callable entrypoints.

The hot path is process-independent: loaded workflow metadata is cached in :persistent_term so module-load/start/resume registration never depends on a GenServer being alive. The supervised child is only a short-lived boot task that upserts loaded versions into the configured instance's repo.

Summary

Functions

Register the current module metadata if the module is a Continuum workflow.

Return the loaded workflow-version entries currently known to this BEAM.

Look up registered metadata for a workflow module.

Backwards-compatible registration helper for tests and old callers.

Register a logical workflow/version hash to a concrete entrypoint module.

Resolve a journaled (workflow, version_hash) pair to a loaded entrypoint.

Upsert loaded workflow versions for an instance into continuum_workflow_versions.

Types

entry()

@type entry() :: %{
  workflow: module(),
  workflow_string: String.t(),
  version: term(),
  hash: binary(),
  version_hash: binary(),
  entrypoint: module()
}

Functions

ensure_registered(module)

(since 0.3.0)
@spec ensure_registered(module()) :: {:ok, entry()} | {:error, term()}

Register the current module metadata if the module is a Continuum workflow.

entries()

(since 0.4.0)
@spec entries() :: [entry()]

Return the loaded workflow-version entries currently known to this BEAM.

lookup(module)

(since 0.3.0)
@spec lookup(module()) :: nil | map()

Look up registered metadata for a workflow module.

This preserves the v0.1 helper shape for callers that only have one loaded version. When multiple entrypoints are registered for the same logical workflow, there is intentionally no "latest" ordering in the content-addressed registry; resume dispatch must use resolve/2 with the journaled hash.

register(module, version, hash)

(since 0.3.0)
@spec register(module(), term(), binary()) :: :ok

Backwards-compatible registration helper for tests and old callers.

register(workflow, version, hash, entrypoint)

(since 0.3.0)
@spec register(module(), term(), binary(), module()) :: :ok

Register a logical workflow/version hash to a concrete entrypoint module.

resolve(workflow, version_hash)

(since 0.3.0)
@spec resolve(module() | String.t(), binary()) :: {:ok, entry()} | {:error, term()}

Resolve a journaled (workflow, version_hash) pair to a loaded entrypoint.

upsert_instance(instance, workflow_modules \\ nil)

(since 0.3.0)
@spec upsert_instance(Continuum.Runtime.Instance.t(), [module()] | nil) :: :ok

Upsert loaded workflow versions for an instance into continuum_workflow_versions.