Pixir.Fork (pixir v0.1.0)

Copy Markdown View Source

Inter-Session fork planning and execution (ADR 0024).

A fork creates a new child Session Log by replaying a prefix of a parent Session's canonical History. The parent Log is never mutated.

Summary

Functions

Plan a fork without writing the child Log.

Create a child Session Log from a parent prefix.

Resolve the fork-tree root Session id for Provider cache-family routing (ADR 0020).

Build a fork plan for CLI dry-run and execution.

Canonical event types copied into a child fork Log.

Functions

dry_run(parent_session_id, opts \\ [])

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

Plan a fork without writing the child Log.

fork(parent_session_id, opts \\ [])

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

Create a child Session Log from a parent prefix.

fork_root_session_id(history, session_id)

@spec fork_root_session_id([Pixir.Event.t()], String.t()) :: String.t()

Resolve the fork-tree root Session id for Provider cache-family routing (ADR 0020).

Returns the root from the first session_fork Event when present; otherwise session_id (a non-fork Session is its own root).

plan(parent_session_id, opts \\ [])

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

Build a fork plan for CLI dry-run and execution.

replay_types()

@spec replay_types() :: [atom()]

Canonical event types copied into a child fork Log.