Spectre.Instance.Ref (Spectre v0.3.0)

Copy Markdown View Source

Logical key for one Agent Instance.

The default Instance granularity is exactly AgentRef + Subject. This value is safe to persist or route and intentionally contains no process location.

Summary

Functions

Reconstructs the pre-0.2.3 Instance Ref for an explicit key migration.

Builds an Instance reference from logical Agent and Subject identities.

Returns the current stable Instance Ref schema version.

Types

t()

@type t() :: %Spectre.Instance.Ref{
  agent_ref: Spectre.AgentRef.t(),
  key: String.t(),
  schema_version: pos_integer(),
  subject: Spectre.Subject.t()
}

Functions

legacy(ref)

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

Reconstructs the pre-0.2.3 Instance Ref for an explicit key migration.

It returns an error when the AgentRef no longer carries the compiled source hints needed to reproduce the legacy address.

new(agent, subject, opts \\ [])

@spec new(Spectre.AgentRef.t() | module(), Spectre.Subject.t() | term(), keyword()) ::
  t()

Builds an Instance reference from logical Agent and Subject identities.

schema_version()

@spec schema_version() :: pos_integer()

Returns the current stable Instance Ref schema version.