Core LibraryAPI Reference

Choose documentation 3

latest

Current version

latest
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

class libtmux-java latest

ServerMirror

Package io.github.libtmux.snapshot.ServerMirror io.github.libtmux.snapshot

A live copy of one tmux server's sessions, windows, panes and clients, rebuilt whenever tmux announces a change.

View as Markdown

Source and package
Module
io.github.libtmux.snapshot
Package
io.github.libtmux:libtmux
Source
libtmux/src/main/java/io/github/libtmux/snapshot/ServerMirror.java
class io.github.libtmux.snapshot.ServerMirror
classreadonly [source]

Description#

A control client attached through an anchor session hears what tmux announces. Any announcement, or a Delivery.Gap in them, starts a fresh Server#snapshot() — never a patch of the last one, since an announcement says that something changed, not everything that did. Announcements that arrive while a snapshot is being taken collapse into one more rebuild, and a rebuild that finds nothing different publishes nothing. Each published View carries an epoch one above the last, counted by this mirror; it is not a number tmux keeps.

tmux keeps no history of what it announced. When the control client ends, the mirror finds the anchor session again by its id and attaches through it with a fresh snapshot; if the session has gone, the mirror ends with TargetGoneException , and if the server has, with the failure that said so. A change tmux does not announce to this client, such as a pane retitled in another session, is seen at the next rebuild, or within refreshEvery when one is given.

Thread-safe. One virtual thread per mirror listens and rebuilds; #close() ends it and the control client with it.

Discussed in Getting started

Members9 members#

Other members9 members#

  • awaitNewer method Waits for a view newer than epoch.
  • cause method Why this mirror ended, when something other than #close() ended it.
  • clearNewer method Disarms the callback #onNewer armed, if one is armed.
  • close method Stops listening and detaches the control client. The last view stays readable. Idempotent.
  • current method The latest published view.
  • isEnded method Whether this mirror has stopped publishing, because it was closed or its anchor has gone.
  • onNewer method Arms a one-shot wakeup for when a view newer than epoch is published or the mirror ends.
  • open method Mirrors the server anchor belongs to, listening through a control client attached to anchor.
  • View struct One published state of the server.
Esc

Type to search.