cluster

package
v0.1.35 Latest Latest
Warning

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

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

Documentation

Overview

Package cluster provides a UI-independent background collector that polls every configured cluster for health, statistics, and capabilities, caching the results so the dashboard and sidebar can read them without blocking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterStatsUpdatedMsg

type ClusterStatsUpdatedMsg struct {
	Clusters []api.ClusterOverview
}

ClusterStatsUpdatedMsg is emitted after a collection cycle so subscribed pages can re-render from the collector cache without polling.

type CollectTickMsg

type CollectTickMsg struct{}

CollectTickMsg triggers a periodic collection; the subscriber turns it into a CollectCmd (see pkg/ui wiring).

type Collector

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

Collector polls clusters and caches overviews + statistics. Safe for concurrent use: the background loop writes while the UI reads.

func New

func New(ds api.KafkaDataSource, interval time.Duration, isReadOnly func(string) bool) *Collector

New builds a Collector. isReadOnly reports the per-cluster read-only flag (may be nil). interval <= 0 falls back to 30s.

func (*Collector) CollectAll

func (c *Collector) CollectAll(ctx context.Context)

CollectAll runs one collection cycle across every cluster in parallel and updates the cache. One cluster failing never affects the others.

func (*Collector) CollectCmd

func (c *Collector) CollectCmd() tea.Cmd

CollectCmd runs a full collection cycle and reports the refreshed overviews.

func (*Collector) GetStatistics

func (c *Collector) GetStatistics(name string) (api.ClusterStatistics, error)

GetStatistics returns cached detailed stats for a cluster (cache-only).

func (*Collector) Interval

func (c *Collector) Interval() time.Duration

Interval returns the configured collection interval.

func (*Collector) ListClusters

func (c *Collector) ListClusters() []api.ClusterOverview

ListClusters returns cached overviews for all clusters (stable order).

func (*Collector) RefreshCluster

func (c *Collector) RefreshCluster(ctx context.Context, name string) (api.ClusterOverview, error)

RefreshCluster forces an immediate collection of a single cluster and returns the refreshed overview. Unknown names yield a ClusterNotFoundError.

func (*Collector) RefreshCmd

func (c *Collector) RefreshCmd(name string) tea.Cmd

RefreshCmd forces an immediate single-cluster refresh and reports the result.

func (*Collector) TickCmd

func (c *Collector) TickCmd() tea.Cmd

TickCmd schedules the next collection cycle after the configured interval.

Jump to

Keyboard shortcuts

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