# tmux_snapshot

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** module
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/d1b6308440cf9eb8f6647e7ae434bce60e849368/apps/libtmux_erlang/src/tmux_snapshot.erl#L1
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_snapshot/

Read an immutable captured graph without performing tmux I/O.

Server-wide lists use numeric ID order. Window links retain every membership,
including multiple indexes for the same window in one session. Session windows
are unique in first-link order; panes within a window use pane index order.
`related/3` accepts a row from this snapshot and returns a
tagged result. A row from another observation cannot silently select a
relationship in this one.

`metadata/1` records source calls, the capture interval,
endpoint generation and the observed server incarnation. Captures span
commands and are not atomic. Values remain readable after their endpoint
closes; actions still validate the row's registered origin. Coverage
distinguishes unloaded data from an empty collection and unavailable fields
from known absence. See the [graph guide](graph.md) for physical windows and
session memberships.

## Members

### Collections and queries

- [`sessions/1`](/en/erlang/latest/reference/tmux_snapshot-sessions-1/) (function): Return captured sessions in numeric ID order. Performs no I/O and raises incomplete_snapshot when that collection was not captured.
- [`windows/1`](/en/erlang/latest/reference/tmux_snapshot-windows-1/) (function): Return unique captured physical windows in numeric ID order. Performs no I/O. Use `window_links/1` for session-relative membership and indexes.
- [`panes/1`](/en/erlang/latest/reference/tmux_snapshot-panes-1/) (function): Return unique captured physical panes in numeric ID order without I/O. `related/3` orders panes within a window by pane index.
- [`related/3`](/en/erlang/latest/reference/tmux_snapshot-related-3/) (function): Traverse a complete captured relationship without I/O. To-many relations return lists; to-one relations return a row or known absence. The input row must belong to this snapshot. Unloaded relations and mismatched rows return tagged errors.

### Common operations

- [`metadata/1`](/en/erlang/latest/reference/tmux_snapshot-metadata-1/) (function): Return capture identity, server generation, source calls, capabilities and read interval metadata. Does not refresh the graph or imply atomic capture.

### Other members

- [`coverage/0`](/en/erlang/latest/reference/t-tmux_snapshot-coverage-0/) (typealias): Per-entity coverage. Use `require/2` to check requirements before evaluation.
- [`coverage/1`](/en/erlang/latest/reference/tmux_snapshot-coverage-1/) (function): Return per-collection, field and relationship coverage. Loaded values, known absence, not_loaded and unavailable capabilities have distinct meanings. Performs no I/O.
- [`entity_coverage/0`](/en/erlang/latest/reference/t-tmux_snapshot-entity_coverage-0/) (typealias): Collection completeness, field availability and relationship completeness. A loaded field can hold a known value or known absence; inspect the row to distinguish them. not_loaded never means empty, and unavailable never means known absence. Completeness is relative to the captured source collection.
- [`get/3`](/en/erlang/latest/reference/tmux_snapshot-get-3/) (function): Look up a row in this capture by ID, or a session/index/window tuple for a window link. Returns none for a known missing identity and a tagged coverage error for an unloaded collection. Performs no I/O.
- [`metadata/0`](/en/erlang/latest/reference/t-tmux_snapshot-metadata-0/) (typealias): Capture identity and provenance. id identifies this snapshot, origin its registered endpoint and generation the endpoint lifetime. model_version names the row representation. graph describes relationship coverage, not atomicity.
- [`query_metadata/0`](/en/erlang/latest/reference/t-tmux_snapshot-query_metadata-0/) (typealias): Source-query capture diagnostics. candidate_count is the deduplicated candidate identity count before local residuals and limits. pushed_down records a nontrivial native condition in the plan, not proof that its command ran: empty collections can skip it. source_calls records actual capture commands. The flag does not mean the full predicate was translated. attempt starts at one and increases only for an explicitly requested retry.
- [`require/2`](/en/erlang/latest/reference/tmux_snapshot-require-2/) (function): Check every declared collection/field/relationship requirement before local evaluation. Returns an incomplete_snapshot error with missing requirements when the capture cannot answer faithfully. Performs no I/O, even on empty data.
- [`requirement/0`](/en/erlang/latest/reference/t-tmux_snapshot-requirement-0/) (typealias): A collection, field or complete relationship needed for faithful local evaluation.
- [`rows/2`](/en/erlang/latest/reference/tmux_snapshot-rows-2/) (function): Return a captured collection by schema entity. Performs no I/O. An unloaded collection raises incomplete_snapshot rather than appearing empty.
- [`source_call/0`](/en/erlang/latest/reference/t-tmux_snapshot-source_call-0/) (typealias): One completed capture command and its stdout byte count. started and finished are local monotonic microseconds, not wall-clock timestamps. The interval includes identity preflight and command completion; it is not an atomic read.
- [`t/0`](/en/erlang/latest/reference/t-tmux_snapshot-t-0/) (typealias): An immutable captured graph with identity, indexes, coverage and source intervals.
- [`window_links/1`](/en/erlang/latest/reference/tmux_snapshot-window_links-1/) (function): Return every captured membership, ordered by numeric session ID, index and window ID. Multiple links to the same physical window are preserved. Performs no I/O; link identity belongs to this snapshot.

## Guides

Pages that discuss `tmux_snapshot`.

- [Native API documentation](/en/erlang/latest/guides/api-documentation/)
