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 ¶
- type ClusterStatsUpdatedMsg
- type CollectTickMsg
- type Collector
- func (c *Collector) CollectAll(ctx context.Context)
- func (c *Collector) CollectCmd() tea.Cmd
- func (c *Collector) GetStatistics(name string) (api.ClusterStatistics, error)
- func (c *Collector) Interval() time.Duration
- func (c *Collector) ListClusters() []api.ClusterOverview
- func (c *Collector) RefreshCluster(ctx context.Context, name string) (api.ClusterOverview, error)
- func (c *Collector) RefreshCmd(name string) tea.Cmd
- func (c *Collector) TickCmd() tea.Cmd
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 ¶
New builds a Collector. isReadOnly reports the per-cluster read-only flag (may be nil). interval <= 0 falls back to 30s.
func (*Collector) CollectAll ¶
CollectAll runs one collection cycle across every cluster in parallel and updates the cache. One cluster failing never affects the others.
func (*Collector) CollectCmd ¶
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) ListClusters ¶
func (c *Collector) ListClusters() []api.ClusterOverview
ListClusters returns cached overviews for all clusters (stable order).
func (*Collector) RefreshCluster ¶
RefreshCluster forces an immediate collection of a single cluster and returns the refreshed overview. Unknown names yield a ClusterNotFoundError.
func (*Collector) RefreshCmd ¶
RefreshCmd forces an immediate single-cluster refresh and reports the result.