Jidoka.Session.Lineage (Jidoka v0.9.0)

Copy Markdown View Source

Durable parentage for a session created from a safe snapshot fork.

Lineage identifies the direct parent, the source snapshot, and the root of the fork tree. It does not permit state mutation or effect re-execution.

Summary

Functions

Builds session lineage from keyword or map attributes.

Builds session lineage and raises if the attributes are invalid.

Builds the next lineage record for a session fork.

Returns the Zoi schema for session lineage.

Types

t()

@type t() :: %Jidoka.Session.Lineage{
  depth: integer(),
  forked_at_ms: integer(),
  parent_session_id: binary(),
  root_session_id: binary(),
  source_snapshot_id: binary()
}

Functions

new(attrs)

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

Builds session lineage from keyword or map attributes.

new!(attrs)

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

Builds session lineage and raises if the attributes are invalid.

next(lineage, parent_session_id, snapshot_id, forked_at_ms)

@spec next(t() | nil, String.t(), String.t(), non_neg_integer()) ::
  {:ok, t()} | {:error, term()}

Builds the next lineage record for a session fork.

schema()

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

Returns the Zoi schema for session lineage.