selector

package
v0.0.0-...-4d7396a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

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 GetAvailableNodes

func GetAvailableNodes(nodes []*livekit.Node) []*livekit.Node

func IsAvailable

func IsAvailable(node *livekit.Node) bool

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

func (s *CPULoadSelector) SelectNode(nodes []*livekit.Node) (*livekit.Node, error)

type NodeSelector

type NodeSelector interface {
	SelectNode(nodes []*livekit.Node) (*livekit.Node, error)
}

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

func (s *RandomSelector) SelectNode(nodes []*livekit.Node) (*livekit.Node, error)

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

func (s *RegionAwareSelector) SelectNode(nodes []*livekit.Node) (*livekit.Node, error)

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

func (s *SystemLoadSelector) SelectNode(nodes []*livekit.Node) (*livekit.Node, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL