Documentation ¶
Index ¶
- Constants
- Variables
- func GetAvailableNodes(nodes []*livekit.Node) []*livekit.Node
- func IsAvailable(node *livekit.Node) bool
- func LimitsReached(limitConfig config.LimitConfig, nodeStats *livekit.NodeStats) bool
- type CPULoadSelector
- type NodeSelector
- type RandomSelector
- 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") )
View Source
var ErrUnsupportedSelector = errors.New("unsupported node selector")
Functions ¶
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 CPULoadSelector ¶
type CPULoadSelector struct {
CPULoadLimit float32
}
CPULoadSelector eliminates nodes that have CPU usage higher than CPULoadLimit then selects a node randomly 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 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 []config.RegionConfig) (*RegionAwareSelector, error)
func (*RegionAwareSelector) SelectNode ¶
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.