cluster

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cluster provides cluster state collection functionality for FODC agent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateClusterStateAddrs

func GenerateClusterStateAddrs(ports []string) []string

GenerateClusterStateAddrs generates cluster state gRPC addresses from the given ports.

func NodeRoleFromNode

func NodeRoleFromNode(node *databasev1.Node) string

NodeRoleFromNode determines the node role string from the Node's role and labels.

func StopCollector

func StopCollector(collector *Collector)

StopCollector stops the collector if it's not nil.

Types

type Collector

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

Collector collects cluster state from BanyanDB nodes via gRPC and stores the data.

func NewCollector

func NewCollector(log *logger.Logger, addrs []string, interval time.Duration, podName string) *Collector

NewCollector creates a new cluster state collector.

func StartCollector

func StartCollector(ctx context.Context, log *logger.Logger, ports []string, interval time.Duration, podName string) (*Collector, error)

StartCollector creates and starts a cluster state collector.

func (*Collector) GetClusterTopology

func (c *Collector) GetClusterTopology() TopologyMap

GetClusterTopology returns the aggregated cluster topology across all endpoints.

func (*Collector) GetCurrentNodes

func (c *Collector) GetCurrentNodes() map[string]*databasev1.Node

GetCurrentNodes returns all current node info, keyed by endpoint address.

func (*Collector) GetNodeInfo

func (c *Collector) GetNodeInfo() (nodeRole string, nodeLabels map[string]string)

GetNodeInfo returns the processed node role and labels from the first available current node.

func (*Collector) SetClusterTopology

func (c *Collector) SetClusterTopology(topology TopologyMap)

SetClusterTopology sets the cluster topology data, primarily for tests.

func (*Collector) Start

func (c *Collector) Start(ctx context.Context) error

Start starts the cluster state collector.

func (*Collector) Stop

func (c *Collector) Stop()

Stop stops the cluster state collector.

func (*Collector) WaitForNodeFetched

func (c *Collector) WaitForNodeFetched(ctx context.Context) error

WaitForNodeFetched waits until the current node info has been fetched.

type TopologyMap

type TopologyMap struct {
	Nodes []*databasev1.Node `json:"nodes"`
	Calls []*fodcv1.Call     `json:"calls"`
}

TopologyMap represents processed cluster data for a single endpoint.

Jump to

Keyboard shortcuts

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