diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-25 21:44:14 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-25 21:44:14 +0200 |
| commit | f6acb83f5b666659e34d092811fb9ff628a85494 (patch) | |
| tree | 5a488bb146dba47f5c729226da07b07d340a611e /internal/tui | |
| parent | 78dfb8ad0f844099280d102407449da0b456a84e (diff) | |
Add late-bound probe manager access for TUI
Diffstat (limited to 'internal/tui')
| -rw-r--r-- | internal/tui/tui.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/internal/tui/tui.go b/internal/tui/tui.go index 5aff6a2..ea35b04 100644 --- a/internal/tui/tui.go +++ b/internal/tui/tui.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "ior/internal/flags" + "ior/internal/probemanager" "ior/internal/statsengine" common "ior/internal/tui/common" dashboardui "ior/internal/tui/dashboard" @@ -41,6 +42,13 @@ type snapshotSource interface { Snapshot() *statsengine.Snapshot } +// ProbeManager exposes runtime probe controls to TUI layers. +type ProbeManager interface { + States() []probemanager.ProbeState + Toggle(syscall string) error + ActiveCount() (int, int) +} + var dashboardSourceState struct { mu sync.RWMutex source snapshotSource @@ -51,6 +59,11 @@ var eventStreamSourceState struct { source *eventstream.RingBuffer } +var probeManagerState struct { + mu sync.RWMutex + manager ProbeManager +} + // SetDashboardSnapshotSource sets the snapshot source used by dashboard mode. func SetDashboardSnapshotSource(source snapshotSource) { dashboardSourceState.mu.Lock() @@ -65,6 +78,13 @@ func SetEventStreamSource(source *eventstream.RingBuffer) { eventStreamSourceState.mu.Unlock() } +// SetProbeManager sets the probe manager used by TUI probe controls. +func SetProbeManager(manager ProbeManager) { + probeManagerState.mu.Lock() + probeManagerState.manager = manager + probeManagerState.mu.Unlock() +} + func getDashboardSnapshotSource() snapshotSource { dashboardSourceState.mu.RLock() defer dashboardSourceState.mu.RUnlock() @@ -77,6 +97,12 @@ func getEventStreamSource() *eventstream.RingBuffer { return eventStreamSourceState.source } +func getProbeManager() ProbeManager { + probeManagerState.mu.RLock() + defer probeManagerState.mu.RUnlock() + return probeManagerState.manager +} + // Run starts the TUI program in alternate screen mode. func Run() error { return RunWithTraceStarter(defaultTraceStarter) |
