Documentation
¶
Overview ¶
Package cluster provides cluster state collection functionality for FODC agent.
Index ¶
- func GenerateClusterStateAddrs(ports []string) []string
- func NodeRoleFromNode(node *databasev1.Node) string
- func StopCollector(collector *Collector)
- type Collector
- func (c *Collector) GetClusterTopology() TopologyMap
- func (c *Collector) GetCurrentNodes() map[string]*databasev1.Node
- func (c *Collector) GetNodeInfo() (nodeRole string, nodeLabels map[string]string)
- func (c *Collector) SetClusterTopology(topology TopologyMap)
- func (c *Collector) Start(ctx context.Context) error
- func (c *Collector) Stop()
- func (c *Collector) WaitForNodeFetched(ctx context.Context) error
- type TopologyMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateClusterStateAddrs ¶
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 ¶
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.
type TopologyMap ¶
type TopologyMap struct {
Nodes []*databasev1.Node `json:"nodes"`
Calls []*fodcv1.Call `json:"calls"`
}
TopologyMap represents processed cluster data for a single endpoint.