Jidoka.Runtime.AgentSnapshot (Jidoka v0.8.0-beta.1)

Copy Markdown View Source

Serializable semantic snapshot for hibernate/resume.

Summary

Types

t()

@type t() :: %Jidoka.Runtime.AgentSnapshot{
  agent_id: binary(),
  cursor: term(),
  metadata: map(),
  schema_version: integer(),
  snapshot_id: binary(),
  turn_state: term()
}

Functions

deserialize(arg1)

@spec deserialize(String.t()) :: {:ok, t()} | {:error, term()}

Restores a snapshot produced by serialize/1.

from_input(snapshot)

@spec from_input(t() | keyword() | map() | String.t()) ::
  {:ok, t()} | {:error, term()}

from_turn_state(state, cursor, opts \\ [])

@spec from_turn_state(Jidoka.Turn.State.t(), Jidoka.Turn.Cursor.t(), keyword()) ::
  {:ok, t()} | {:error, term()}

from_turn_state!(state, cursor, opts \\ [])

@spec from_turn_state!(Jidoka.Turn.State.t(), Jidoka.Turn.Cursor.t(), keyword()) ::
  t()

new(attrs)

@spec new(keyword() | map()) :: {:ok, t()} | {:error, term()}

new!(attrs)

@spec new!(keyword() | map()) :: t()

schema()

@spec schema() :: Zoi.schema()

schema_version()

@spec schema_version() :: pos_integer()

serialize(snapshot_input)

@spec serialize(t() | keyword() | map()) :: {:ok, String.t()} | {:error, term()}

Serializes a snapshot into an opaque durable string.

The format is intentionally internal to Jidoka. It preserves Elixir data fidelity across hibernate/resume while the schema version remains the public compatibility boundary.

serialize!(snapshot_input)

@spec serialize!(t() | keyword() | map()) :: String.t()