Documentation ¶
Index ¶
- Constants
- Variables
- func GetAvailableNodes(nodes []*livekit.Node) []*livekit.Node
- func GetNodeSysload(node *livekit.Node) float32
- func IsAvailable(node *livekit.Node) bool
- func LimitsReached(limitConfig config.LimitConfig, nodeStats *livekit.NodeStats) bool
- func SelectSortedNode(nodes []*livekit.Node, sortBy string) (*livekit.Node, error)
- type AnySelector
- type CPULoadSelector
- type NodeSelector
- type RegionAwareSelector
- type SystemLoadSelector
Constants ¶
View Source
const AvailableSeconds = 5
Variables ¶
View Source
var ( ErrNoAvailableNodes = errors.New("could not find any available nodes") ErrCurrentRegionNotSet = errors.New("current region cannot be blank") ErrCurrentRegionUnknownLatLon = errors.New("unknown lat and lon for the current region") ErrSortByNotSet = errors.New("sort by option cannot be blank") ErrSortByUnknown = errors.New("unknown sort by option") )
View Source
var ErrUnsupportedSelector = errors.New("unsupported node selector")
Functions ¶
func GetNodeSysload ¶
func IsAvailable ¶
checks if a node has been updated recently to be considered for selection
func LimitsReached ¶
func LimitsReached(limitConfig config.LimitConfig, nodeStats *livekit.NodeStats) bool
TODO: check remote node configured limit, instead of this node's config
Types ¶
type AnySelector ¶
type AnySelector struct {
SortBy string
}
AnySelector selects any available node with no limitations
func (*AnySelector) SelectNode ¶
type CPULoadSelector ¶
CPULoadSelector eliminates nodes that have CPU usage higher than CPULoadLimit then selects a node from nodes that are not overloaded
func (*CPULoadSelector) SelectNode ¶
type NodeSelector ¶
NodeSelector selects an appropriate node to run the current session
func CreateNodeSelector ¶
func CreateNodeSelector(conf *config.Config) (NodeSelector, error)
type RegionAwareSelector ¶
type RegionAwareSelector struct { SystemLoadSelector CurrentRegion string SortBy 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 []config.RegionConfig, sortBy string) (*RegionAwareSelector, error)
func (*RegionAwareSelector) SelectNode ¶
type SystemLoadSelector ¶
SystemLoadSelector eliminates nodes that surpass has a per-cpu node higher than SysloadLimit then selects a node from nodes that are not overloaded
func (*SystemLoadSelector) SelectNode ¶
Click to show internal directories.
Click to hide internal directories.