Continuum.VersionRegistry (continuum v0.6.2)

Copy Markdown View Source

Registry for workflow version hashes and callable entrypoints.

Loaded workflow metadata is cached in :persistent_term. Each durable instance also owns a registrar process that upserts configured versions at boot, retries transient failures, and records versions discovered on first use.

Summary

Functions

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

Register workflow metadata locally and ensure it is durable for an instance.

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.

Resolve a workflow version and ensure the discovered entry is durable for an instance.

Return the durable registrar status for an instance.

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.

ensure_registered(module, instance)

(since 0.6.2)
@spec ensure_registered(module(), Continuum.Runtime.Instance.t()) ::
  {:ok, entry()} | {:error, term()}

Register workflow metadata locally and ensure it is durable for an instance.

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.

resolve(workflow, version_hash, instance)

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

Resolve a workflow version and ensure the discovered entry is durable for an instance.

status(instance_or_name \\ Continuum)

(since 0.6.2)
@spec status(Continuum.Runtime.Instance.t() | atom()) :: map()

Return the durable registrar status for an instance.

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.