Documentation
¶
Index ¶
Constants ¶
View Source
const (
AvailableSeconds = 5
)
Variables ¶
Functions ¶
func IsAvailable ¶
checks if a node has been updated recently to be considered for selection
Types ¶
type RandomSelector ¶
type RandomSelector struct {
}
RandomSelector selects an available node at random
func (*RandomSelector) SelectNode ¶
type RegionAwareSelector ¶
type RegionAwareSelector struct {
SystemLoadSelector
CurrentRegion string
// contains filtered or unexported fields
}
RegionAwareSelector prefers available nodes that are closest to the region of the current instance
func NewRegionAwareSelector ¶
func NewRegionAwareSelector(currentRegion string, regions []RegionConfig) (*RegionAwareSelector, error)
func (*RegionAwareSelector) SelectNode ¶
type RegionConfig ¶
type RegionConfig struct {
Name string `yaml:"name"`
Lat float64 `yaml:"lat"`
Lon float64 `yaml:"lon"`
}
RegionConfig lists available regions and their latitude/longitude, so the selector would prefer regions that are closer
type SystemLoadSelector ¶
type SystemLoadSelector struct {
SysloadLimit float32
}
SystemLoadSelector eliminates nodes that surpass has a per-cpu node higher than SysloadLimit then selects a node randomly from nodes that are not overloaded
func (*SystemLoadSelector) SelectNode ¶
Click to show internal directories.
Click to hide internal directories.