fleet

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package fleet renders a live, one-row-per-host overview of all registered servers, collecting metrics from each concurrently. Press Enter on a host to drill into its full dashboard and Esc/q to return (wired by cmd/kay via RunView); the overview itself is read-only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(hosts []Host, opts Options) error

Run shows the fleet overview standalone: it owns the terminal and input for the whole session. Enter on a host has no effect here (drill-in needs a dashboard coordinator — see cmd/kay); use RunView for that.

Types

type Host

type Host struct {
	Server config.Server
	Dial   func() (*sshx.Client, error)
}

Host is a server plus a function that opens a connection to it.

type Options

type Options struct {
	Interval  time.Duration
	Color     string
	Anonymize bool // mask aliases/hosts (for demos/screenshots)
}

Options configures the fleet view.

type Selection added in v0.2.0

type Selection struct {
	Host   Host
	Client metrics.Runner
}

Selection is the host a user chose to drill into, together with its live persistent connection so the dashboard can reuse it — running its metrics over the same transport — instead of opening a second one. The connection keeps self-healing in the background, so the dashboard needs no separate redial.

type Session added in v0.2.0

type Session struct {
	// contains filtered or unexported fields
}

Session owns one persistent, self-healing SSH connection per host and keeps them alive across repeated RunView calls, so drilling into a host's dashboard and back never re-handshakes. The caller (cmd/kay) creates one Session for the whole interactive session and Closes it at the end.

func NewSession added in v0.2.0

func NewSession(hosts []Host) *Session

NewSession registers every host with a fresh connection pool and starts connecting to all of them in the background (dial concurrency is capped).

func (*Session) Close added in v0.2.0

func (s *Session) Close()

Close tears down every connection in the pool.

func (*Session) RunView added in v0.2.0

func (s *Session) RunView(scr *tui.Screen, events <-chan tui.Event, opts Options) (*Selection, error)

RunView runs the fleet overview against an already-open screen and a shared input channel, reusing the session's persistent connections. It returns the host the user selected with Enter (with its live connection to reuse), or nil when they quit.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL