ServerMirror
A live copy of one tmux server's sessions, windows, panes and clients, rebuilt whenever tmux announces a change.
Source and package
- Module
- LibTmux
- Package
- LibTmux
- Source
- src/LibTmux/Snapshots/ServerMirror.cs
-
Description#
A control client attached to an anchor session hears what tmux announces. Any announcement, or the loss of one, starts a fresh capture, never a patch of the last one, since an announcement says that something changed, not everything that did. Announcements that arrive during a capture collapse into one more, and a capture that finds nothing different publishes nothing; activity times, cursor positions and history sizes, which change with every keystroke, do not count as different. Each published view carries an epoch one above the last, counted by this mirror.
tmux announces only some changes to a client: not a pane's running command or working directory, and not a layout change in a session the client is not attached to. Give a refresh interval to see those within that long.
When the control client ends, the mirror finds the anchor session again by its ID and attaches through it; if the session has gone, the mirror ends with
TmuxObjectNotFoundException, and if the server has, with the failure that said so. The client asks tmux for notifications only, not pane output, and does not affect window sizes.
Members8 members#
Other members8 members#
- Current property Gets the latest published view.
- DisposeAsync method Stops listening and detaches the control client; the last view stays readable.
- Failure property Gets why the mirror ended, when something other than disposal ended it.
- IsEnded property Gets whether the mirror has stopped publishing, because it was disposed or its anchor has gone.
- OpenAsync method Mirrors the server an anchor session belongs to.
- WaitForNewerAsync method Waits for a view newer than an epoch.
- WaitUntilAsync method Waits until a view satisfies a condition, testing the current view first.
- WatchAsync method Streams the current view and then each newer one, skipping any published while the reader was busy.