LibTmux.Snapshot (libtmux v0.0.1-alpha.1)

Copy Markdown View Source

An indexed immutable graph observed over a capture interval.

Construction and traversal perform no I/O. fields declares loaded fields over the supplied entity IDs; complete declares complete server entity sets. Missing declarations remain unloaded, including on empty sets. Unavailable capabilities use a separate declaration. Relations require complete join domains. A snapshot reserves no tmux objects.

Summary

Types

Declared entity sets and field availability; completeness is separate from an empty captured set.

Coverage of one captured entity domain; missing field entries are unloaded.

Construction metadata: one server instance, ordered millisecond timestamps and explicit coverage declarations.

Observed rows grouped by canonical entity; construction validates and deduplicates their identities.

t()

An immutable observation interval with indexed entities and explicit coverage.

Functions

Returns a materialized attached-client selection without I/O.

Looks up one exact observed ID without I/O.

Returns plain observed items in stable identity order without loading data.

Validates observed rows, rejecting conflicts, invalid fields and dangling covered references.

Returns a materialized physical pane selection without I/O.

Resolves a covered relation through captured indexes; never refreshes.

Requires a declared complete entity set, even when it has no rows.

Requires a loaded field over the captured entity domain before evaluation.

Requires a complete relation domain, including known-empty domains.

Returns a materialized session selection without I/O.

Returns a materialized membership selection without I/O.

Returns a materialized physical window selection without I/O.

Types

coverage()

@type coverage() :: %{
  entities: %{required(LibTmux.Schema.entity()) => entity_coverage()}
}

Declared entity sets and field availability; completeness is separate from an empty captured set.

entity_coverage()

@type entity_coverage() :: %{
  ids: MapSet.t(LibTmux.Ref.id()),
  complete: boolean(),
  fields: %{optional(atom()) => :loaded | :unavailable}
}

Coverage of one captured entity domain; missing field entries are unloaded.

option()

@type option() ::
  {:server_instance, String.t()}
  | {:captured_from, integer()}
  | {:captured_until, integer()}
  | {:fields, %{optional(LibTmux.Schema.entity()) => [atom()]}}
  | {:complete, [LibTmux.Schema.entity()]}
  | {:unavailable, %{optional(LibTmux.Schema.entity()) => [atom()]}}

Construction metadata: one server instance, ordered millisecond timestamps and explicit coverage declarations.

rows()

@type rows() :: %{
  optional(LibTmux.Schema.entity()) => [map() | LibTmux.Schema.observation()]
}

Observed rows grouped by canonical entity; construction validates and deduplicates their identities.

t()

@type t() :: %LibTmux.Snapshot{
  captured_from: integer(),
  captured_until: integer(),
  clients: %{optional(String.t()) => LibTmux.Client.t()},
  coverage: coverage(),
  id: pos_integer(),
  indexes: indexes(),
  order: %{required(LibTmux.Schema.entity()) => [LibTmux.Ref.id()]},
  panes: %{optional(String.t()) => LibTmux.Pane.t()},
  schema_version: 1,
  server_instance: String.t(),
  sessions: %{optional(String.t()) => LibTmux.Session.t()},
  window_links: %{optional(LibTmux.Ref.id()) => LibTmux.WindowLink.t()},
  windows: %{optional(String.t()) => LibTmux.Window.t()}
}

An immutable observation interval with indexed entities and explicit coverage.

Functions

clients(snapshot)

@spec clients(t()) :: LibTmux.Selection.t(LibTmux.Client.t())

Returns a materialized attached-client selection without I/O.

fetch(snapshot, entity, id)

Looks up one exact observed ID without I/O.

items(snapshot, entity)

Returns plain observed items in stable identity order without loading data.

new(rows, options)

@spec new(rows(), [option()]) :: {:ok, t()} | {:error, LibTmux.Error.t()}

Validates observed rows, rejecting conflicts, invalid fields and dangling covered references.

panes(snapshot)

@spec panes(t()) :: LibTmux.Selection.t(LibTmux.Pane.t())

Returns a materialized physical pane selection without I/O.

related(snapshot, entity, id, relation)

Resolves a covered relation through captured indexes; never refreshes.

require_complete!(snapshot, entity)

@spec require_complete!(t(), LibTmux.Schema.entity_selector()) :: :ok

Requires a declared complete entity set, even when it has no rows.

require_field!(snapshot, entity, field)

@spec require_field!(t(), LibTmux.Schema.entity_selector(), atom()) :: :ok

Requires a loaded field over the captured entity domain before evaluation.

require_relation!(snapshot, entity, relation, ids \\ :all)

@spec require_relation!(
  t(),
  LibTmux.Schema.entity_selector(),
  atom(),
  :all | [LibTmux.Ref.id()]
) :: :ok

Requires a complete relation domain, including known-empty domains.

sessions(snapshot)

@spec sessions(t()) :: LibTmux.Selection.t(LibTmux.Session.t())

Returns a materialized session selection without I/O.

window_links(snapshot)

@spec window_links(t()) :: LibTmux.Selection.t(LibTmux.WindowLink.t())

Returns a materialized membership selection without I/O.

windows(snapshot)

@spec windows(t()) :: LibTmux.Selection.t(LibTmux.Window.t())

Returns a materialized physical window selection without I/O.