provider

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Logging
	MaxLogLines = 1000

	// Timeouts
	SSHTimeout = 2 * time.Second

	// Process Management
	ProcessListCapacity      = 500
	InternerCleanupFrequency = 1000

	// Network
	NetworkBaseRateMBps = 10.0

	// Protocols
	ProtoTCP = 1
	ProtoUDP = 2
)

Provider Limits and Timeouts

Variables

This section is empty.

Functions

This section is empty.

Types

type ProcessAdapter added in v0.5.0

type ProcessAdapter struct{}

ProcessAdapter wraps process provider functions and implements ProcessProvider interface.

func NewProcessAdapter added in v0.5.0

func NewProcessAdapter() *ProcessAdapter

NewProcessAdapter creates a new ProcessAdapter instance.

func (*ProcessAdapter) FetchOpenFilesCmd added in v0.5.0

func (a *ProcessAdapter) FetchOpenFilesCmd(pid int32) tea.Cmd

FetchOpenFilesCmd returns a command that fetches open files for a process.

func (*ProcessAdapter) FetchProcessCmdlineCmd added in v0.5.0

func (a *ProcessAdapter) FetchProcessCmdlineCmd(pid int32) tea.Cmd

FetchProcessCmdlineCmd returns a command that lazily fetches cmdline for a process.

func (*ProcessAdapter) FetchProcessUsernameCmd added in v0.5.0

func (a *ProcessAdapter) FetchProcessUsernameCmd(pid int32) tea.Cmd

FetchProcessUsernameCmd returns a command that lazily fetches username for a process.

func (*ProcessAdapter) PidsOnlyCmd added in v0.5.0

func (a *ProcessAdapter) PidsOnlyCmd() tea.Cmd

PidsOnlyCmd returns a command that fetches only PIDs for cache warming (lightweight).

func (*ProcessAdapter) ProcessCountCmd added in v0.5.0

func (a *ProcessAdapter) ProcessCountCmd() tea.Cmd

ProcessCountCmd returns a command that fetches the number of running processes (lightweight).

func (*ProcessAdapter) ProcessesCmd added in v0.5.0

func (a *ProcessAdapter) ProcessesCmd(sortBy string, sortDirection string) tea.Cmd

ProcessesCmd returns a command that fetches all running processes with sorting.

func (*ProcessAdapter) ReniceProcessCmdSafe added in v0.5.0

func (a *ProcessAdapter) ReniceProcessCmdSafe(pid int32, delta int) tea.Cmd

ReniceProcessCmdSafe returns a command that changes process priority.

func (*ProcessAdapter) ResumeProcessCmd added in v0.5.0

func (a *ProcessAdapter) ResumeProcessCmd(pid int32) tea.Cmd

ResumeProcessCmd returns a command that resumes a suspended process.

func (*ProcessAdapter) SuspendProcessCmd added in v0.5.0

func (a *ProcessAdapter) SuspendProcessCmd(pid int32) tea.Cmd

SuspendProcessCmd returns a command that suspends a process.

type ProcessProvider added in v0.5.0

type ProcessProvider interface {
	// ProcessesCmd returns a command that fetches all running processes with sorting.
	ProcessesCmd(sortBy string, sortDirection string) tea.Cmd

	// ProcessCountCmd returns a command that fetches the number of running processes (lightweight).
	ProcessCountCmd() tea.Cmd

	// PidsOnlyCmd returns a command that fetches only PIDs for cache warming (lightweight).
	PidsOnlyCmd() tea.Cmd

	// ReniceProcessCmdSafe returns a command that changes process priority.
	// delta < 0 increases priority, delta > 0 decreases priority.
	ReniceProcessCmdSafe(pid int32, delta int) tea.Cmd

	// SuspendProcessCmd returns a command that suspends a process.
	SuspendProcessCmd(pid int32) tea.Cmd

	// ResumeProcessCmd returns a command that resumes a suspended process.
	ResumeProcessCmd(pid int32) tea.Cmd

	// FetchOpenFilesCmd returns a command that fetches open files for a process.
	FetchOpenFilesCmd(pid int32) tea.Cmd

	// FetchProcessCmdlineCmd returns a command that lazily fetches cmdline for a process.
	FetchProcessCmdlineCmd(pid int32) tea.Cmd

	// FetchProcessUsernameCmd returns a command that lazily fetches username for a process.
	FetchProcessUsernameCmd(pid int32) tea.Cmd
}

ProcessProvider defines the interface for process management providers. Each method returns a tea.Cmd that produces a message when executed.

type RemoteAdapter added in v0.5.0

type RemoteAdapter struct{}

RemoteAdapter wraps remote provider functions and implements RemoteProvider interface.

func NewRemoteAdapter added in v0.5.0

func NewRemoteAdapter() *RemoteAdapter

NewRemoteAdapter creates a new RemoteAdapter instance.

func (*RemoteAdapter) CheckRemoteCmd added in v0.5.0

func (a *RemoteAdapter) CheckRemoteCmd(host config.RemoteHostConfig) tea.Cmd

CheckRemoteCmd returns a command that checks remote host connectivity and fetches full metrics.

type RemoteProvider added in v0.5.0

type RemoteProvider interface {
	// CheckRemoteCmd returns a command that checks remote host connectivity and fetches full metrics.
	CheckRemoteCmd(host config.RemoteHostConfig) tea.Cmd
}

RemoteProvider defines the interface for remote system access providers. Each method returns a tea.Cmd that produces a message when executed.

type SystemAdapter added in v0.5.0

type SystemAdapter struct{}

SystemAdapter wraps system provider functions and implements SystemProvider interface.

func NewSystemAdapter added in v0.5.0

func NewSystemAdapter() *SystemAdapter

NewSystemAdapter creates a new SystemAdapter instance.

func (*SystemAdapter) BatteryCmd added in v0.5.0

func (a *SystemAdapter) BatteryCmd() tea.Cmd

BatteryCmd returns a command that fetches battery status.

func (*SystemAdapter) ConnectionsCmd added in v0.5.0

func (a *SystemAdapter) ConnectionsCmd() tea.Cmd

ConnectionsCmd returns a command that fetches network connections.

func (*SystemAdapter) DetectHardware added in v0.5.0

func (a *SystemAdapter) DetectHardware()

DetectHardware runs hardware capability detection.

func (*SystemAdapter) DiskIOCmd added in v0.5.0

func (a *SystemAdapter) DiskIOCmd() tea.Cmd

DiskIOCmd returns a command that fetches disk I/O statistics.

func (*SystemAdapter) DiskInfoCmd added in v0.5.0

func (a *SystemAdapter) DiskInfoCmd() tea.Cmd

DiskInfoCmd returns a command that fetches disk partition information.

func (*SystemAdapter) FastMetricsCmd added in v0.5.0

func (a *SystemAdapter) FastMetricsCmd() tea.Cmd

FastMetricsCmd returns a command that fetches CPU, memory, and load average metrics.

func (*SystemAdapter) GpuInfoCmd added in v0.5.0

func (a *SystemAdapter) GpuInfoCmd() tea.Cmd

GpuInfoCmd returns a command that fetches GPU information.

func (*SystemAdapter) HasAmdGPU added in v0.5.0

func (a *SystemAdapter) HasAmdGPU() bool

HasAmdGPU returns true if an AMD GPU is detected.

func (*SystemAdapter) HasBattery added in v0.5.0

func (a *SystemAdapter) HasBattery() bool

HasBattery returns true if a battery is detected.

func (*SystemAdapter) HasDiskIO added in v0.5.0

func (a *SystemAdapter) HasDiskIO() bool

HasDiskIO returns true if disk I/O metrics are available.

func (*SystemAdapter) HasNetworkInterfaces added in v0.5.0

func (a *SystemAdapter) HasNetworkInterfaces() bool

HasNetworkInterfaces returns true if network interfaces are detected.

func (*SystemAdapter) HasNvidiaGPU added in v0.5.0

func (a *SystemAdapter) HasNvidiaGPU() bool

HasNvidiaGPU returns true if an NVIDIA GPU is detected.

func (*SystemAdapter) HasServices added in v0.5.0

func (a *SystemAdapter) HasServices() bool

HasServices returns true if system services are available.

func (*SystemAdapter) HasTempSensors added in v0.5.0

func (a *SystemAdapter) HasTempSensors() bool

HasTempSensors returns true if temperature sensors are available.

func (*SystemAdapter) HostInfoCmd added in v0.5.0

func (a *SystemAdapter) HostInfoCmd() tea.Cmd

HostInfoCmd returns a command that fetches host information.

func (*SystemAdapter) NetworkInterfacesCmd added in v0.5.0

func (a *SystemAdapter) NetworkInterfacesCmd() tea.Cmd

NetworkInterfacesCmd returns a command that fetches network interface statistics.

func (*SystemAdapter) ServicesCmd added in v0.5.0

func (a *SystemAdapter) ServicesCmd() tea.Cmd

ServicesCmd returns a command that fetches system services.

func (*SystemAdapter) SlowMetricsCmd added in v0.5.0

func (a *SystemAdapter) SlowMetricsCmd() tea.Cmd

SlowMetricsCmd returns a command that fetches disk and network I/O metrics.

func (*SystemAdapter) SystemLogsCmd added in v0.5.0

func (a *SystemAdapter) SystemLogsCmd() tea.Cmd

SystemLogsCmd returns a command that fetches system logs.

func (*SystemAdapter) TempCmd added in v0.5.0

func (a *SystemAdapter) TempCmd() tea.Cmd

TempCmd returns a command that fetches temperature sensor data.

func (*SystemAdapter) TickCmd added in v0.5.0

func (a *SystemAdapter) TickCmd(d time.Duration) tea.Cmd

TickCmd returns a command that sends tick messages at the specified duration.

type SystemProvider added in v0.5.0

type SystemProvider interface {
	// TickCmd returns a command that sends tick messages at the specified duration.
	TickCmd(d time.Duration) tea.Cmd

	// FastMetricsCmd returns a command that fetches CPU, memory, and load average metrics.
	FastMetricsCmd() tea.Cmd

	// SlowMetricsCmd returns a command that fetches disk and network I/O metrics.
	SlowMetricsCmd() tea.Cmd

	// HostInfoCmd returns a command that fetches host information (OS, platform, uptime, etc.).
	HostInfoCmd() tea.Cmd

	// GpuInfoCmd returns a command that fetches GPU information (NVIDIA, AMD, Intel).
	GpuInfoCmd() tea.Cmd

	// TempCmd returns a command that fetches temperature sensor data.
	TempCmd() tea.Cmd

	// BatteryCmd returns a command that fetches battery status.
	BatteryCmd() tea.Cmd

	// DiskInfoCmd returns a command that fetches disk partition information.
	DiskInfoCmd() tea.Cmd

	// DiskIOCmd returns a command that fetches disk I/O statistics.
	DiskIOCmd() tea.Cmd

	// NetworkInterfacesCmd returns a command that fetches network interface statistics.
	NetworkInterfacesCmd() tea.Cmd

	// ConnectionsCmd returns a command that fetches network connections.
	ConnectionsCmd() tea.Cmd

	// ServicesCmd returns a command that fetches system services.
	ServicesCmd() tea.Cmd

	// SystemLogsCmd returns a command that fetches system logs.
	SystemLogsCmd() tea.Cmd

	// HasNvidiaGPU returns true if an NVIDIA GPU is detected.
	HasNvidiaGPU() bool

	// HasAmdGPU returns true if an AMD GPU is detected.
	HasAmdGPU() bool

	// HasBattery returns true if a battery is detected.
	HasBattery() bool

	// HasNetworkInterfaces returns true if network interfaces are detected.
	HasNetworkInterfaces() bool

	// HasDiskIO returns true if disk I/O metrics are available.
	HasDiskIO() bool

	// HasServices returns true if system services are available.
	HasServices() bool

	// HasTempSensors returns true if temperature sensors are available.
	HasTempSensors() bool

	// DetectHardware runs hardware capability detection.
	DetectHardware()
}

SystemProvider defines the interface for system metrics providers. Each method returns a tea.Cmd that produces a message when executed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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