Core LibraryunreleasedAPI Reference

Choose documentation 1

latest

Current version

latest
English

Unreleased libtmux_erlang has not been released. Its API may change during development. This site's structure and URLs may change too.

module libtmux-erlang latest

tmux_query

Build and execute explicit queries over the tmux graph.

Source and package
Qualified name
tmux_query
Package
libtmux_erlang
Source
apps/libtmux_erlang/src/tmux_query.erl

Description#

Use fetch/1 to execute a query. Constructors, where/2, limit/2, pushdown/2 and explain/1 perform no tmux I/O. Criteria are validated when added, and repeated conditions conjoin. Fetching returns an ordered tmux_select selection backed by a complete tmux_snapshot graph. By default the full captured view is filtered locally. Enable native candidate exclusion with pushdown/2: it can add a scan without reducing complete-graph hydration. The candidate is a necessary condition; the full filter still runs before the limit.

Captures span commands and are not atomic. Candidate IDs excluded at one observation cannot be recovered by later local filtering. Disabling pushdown/2 evaluates the complete captured view without an earlier candidate exclusion. Numeric candidate fields come from the restricted scalar codec and must agree with the capture's scalar observations. Text and relationships remain local.

Captures emit bounded OTP Logger reports with their snapshot ID and endpoint generation. See runtime diagnostics for observation cost, rejection reports and configuration.

Examples#

1> Q0 = tmux_query:panes(unopened), ok.
ok
2> Q = tmux_query:where(#{width => #{gte => 120}}, Q0), ok.
ok
3> maps:get(format, maps:get(candidate, tmux_query:explain(Q))).
<<"1">>
4> Pushed = tmux_query:pushdown(true, Q), ok.
ok
5> maps:get(format, maps:get(candidate, tmux_query:explain(Pushed))).
<<"#{e|>=|:#{pane_width},120}">>

Members17#

Collections and queries3#

  • sessions/1 function Describe a future server-wide session query without executing tmux.
  • windows/1 function Describe a future query over unique physical windows. Performs no I/O.
  • panes/1 function Describe a future server-wide physical pane query. Performs no I/O; fetch/1 is the execution boundary.

Common operations2#

  • explain/1 function Inspect command templates, necessary candidate conditions, full residual, hydration, required fields, ordering and temporal assumptions. Performs no I/O and does not contact the endpoint to claim dynamic capabilities.
  • fetch/2 function Execute the planned observation, full local predicate and final limit.

Other members12#

  • candidate/0 typealias Native necessary condition. format is a rendered tmux expression; exact means the translation covers the whole predicate for one observed state. A true fallback can admit every row. numeric_range describes qualified integer conversion, and is omitted for disabled/oversized fallback plans.
  • command_plan/0 typealias Capture phases: initial identity/scalar scans, optional candidate scans, complete text/byte hydration and final identity/scalar scans. hydration gives the default batched templates; isolated_hydration describes the explicit isolated option and unqualified-field fallback. An empty server skips window/pane scans. Execution still validates capture bounds and can fail.
  • fetch_options/0 typealias Capture bounds plus an explicitly requested single inconsistent-capture retry; default retry is zero.
  • fetch/1 function Execute with default capture bounds and no retry. Returns an ordered selection whose complete graph remains locally readable. See fetch/2 for resource limits, requested retries and operational errors.
  • limit/2 function Set a final result limit from 0 through 65536, applied after residual filtering and identity handling. It is not a candidate-fetch limit. Performs no I/O; invalid counts raise bad_query_limit.
  • local_reason/0 typealias Why part of a predicate stays local. field and relation contain stable schema IDs, not Erlang names or tmux formats. An unsupported leaf may broaden the native condition; it never removes the full local predicate.
  • plan/0 typealias Pure explanation of a query. pushdown reports whether candidate exclusion is enabled (disabled by default). residual is the full portable predicate, required lists coverage requirements, and limit applies after residual evaluation. ordering and deduplication name the identity policy, not arbitrary map order. capabilities describes the planner baseline without probing a live endpoint.
  • pushdown/2 function Enable or disable native candidate exclusion, returning a new query. The default is disabled: evaluate the complete captured view locally. Enabling it can add a candidate scan without reducing hydration; neither mode promises an atomic graph. Performs no I/O.
  • source_command/0 typealias Diagnostic command template, not executable argv. Scan templates carry args; text/byte hydration escapes each field once before column framing. Unqualified schema fields use isolated target = observed_id templates, resolved only while capturing. codec states how returned data is framed, including the version-specific print layer. This value grants no atomicity or persistent-connection guarantee.
  • t/0 typealias An immutable description of future tmux reads. Only fetch executes it.
  • where/2 function Validate trusted criteria for this entity and conjoin them with prior conditions. Successive calls share the same normalized resource limits as one flat conjunction. Each relationship quantifier retains its own scope. Returns a new immutable query; malformed criteria raise bad_filter. Performs no I/O.
  • window_links/1 function Describe a future query over session-relative window memberships. Repeated physical windows retain distinct membership identity. Performs no I/O.

Guides#

Pages that discuss tmux_query.

Esc

Type to search.

Reference previewOpen reference