Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClosestNodeSelectorAlgorithm ¶
type ClosestNodeSelectorAlgorithm struct {
// contains filtered or unexported fields
}
ClosestNodeSelectorAlgorithm selects the node with the lowest measured TCP connect latency, excluding any nodes present in the banlist. Latency measurements are cached for a configured duration and refreshed periodically to reduce overhead.
func NewClosestNodeSelectorAlgorithm ¶
func NewClosestNodeSelectorAlgorithm( reg registry.NodeRegistry, cacheExpiry time.Duration, connectTimeout time.Duration, preferredNodes ...[]uint32, ) *ClosestNodeSelectorAlgorithm
type ManualNodeSelectorAlgorithm ¶
type ManualNodeSelectorAlgorithm struct {
// contains filtered or unexported fields
}
ManualNodeSelectorAlgorithm always selects the first available node from an explicit list of node IDs. The topic is ignored. If a node in the manual list is not present in the registry or is banned, it is skipped. If no node from the list is usable, selection fails.
This strategy is useful for pinning traffic to specific nodes (e.g., during testing or partial rollouts).
func NewManualNodeSelectorAlgorithm ¶
func NewManualNodeSelectorAlgorithm( reg registry.NodeRegistry, nodeIDs []uint32, ) *ManualNodeSelectorAlgorithm
type NodeSelectorAlgorithm ¶
type NodeSelectorAlgorithm interface {
GetNode(topic topic.Topic, banlist ...[]uint32) (uint32, error)
}
func NewNodeSelector ¶
func NewNodeSelector( reg registry.NodeRegistry, config NodeSelectorConfig, ) (NodeSelectorAlgorithm, error)
type NodeSelectorConfig ¶
type NodeSelectorStrategy ¶
type NodeSelectorStrategy string
const ( NodeSelectorStrategyStable NodeSelectorStrategy = "stable" NodeSelectorStrategyManual NodeSelectorStrategy = "manual" NodeSelectorStrategyOrdered NodeSelectorStrategy = "ordered" NodeSelectorStrategyRandom NodeSelectorStrategy = "random" NodeSelectorStrategyClosest NodeSelectorStrategy = "closest" )
type OrderedPreferenceNodeSelectorAlgorithm ¶
type OrderedPreferenceNodeSelectorAlgorithm struct {
// contains filtered or unexported fields
}
OrderedPreferenceNodeSelectorAlgorithm selects the first available node from a preferred ordered list, falling back to the first unbanned node in the full registry if none of the preferred nodes are usable.
This strategy is useful when you want to prioritize certain nodes but retain automatic fallback in case preferred nodes are unavailable.
func NewOrderedPreferenceNodeSelectorAlgorithm ¶
func NewOrderedPreferenceNodeSelectorAlgorithm( reg registry.NodeRegistry, preferredNodeIDs []uint32, ) *OrderedPreferenceNodeSelectorAlgorithm
type RandomNodeSelectorAlgorithm ¶
type RandomNodeSelectorAlgorithm struct {
// contains filtered or unexported fields
}
RandomNodeSelectorAlgorithm selects a node uniformly at random from all currently available nodes, excluding any nodes present in the banlist.
This strategy provides load distribution but does not provide affinity or determinism.
func NewRandomNodeSelectorAlgorithm ¶
func NewRandomNodeSelectorAlgorithm( reg registry.NodeRegistry, ) *RandomNodeSelectorAlgorithm
type StableHashingNodeSelectorAlgorithm ¶
type StableHashingNodeSelectorAlgorithm struct {
// contains filtered or unexported fields
}
StableHashingNodeSelectorAlgorithm implements deterministic topic-to-node selection using a stable hash. Nodes are sorted by NodeID to ensure consistent ordering.
This strategy provides stickiness (topic affinity) and minimizes churn as long as the node set is stable, but any node set change will cause remapping for some topics.
func NewStableHashingNodeSelectorAlgorithm ¶
func NewStableHashingNodeSelectorAlgorithm( reg registry.NodeRegistry, ) *StableHashingNodeSelectorAlgorithm