Documentation ¶
Index ¶
- Constants
- Variables
- func DispatchWorkerSignal(req *livekit.WorkerMessage, h WorkerSignalHandler) error
- func GetAgentTopic(agentName, namespace string) string
- func JobStatusIsEnded(s livekit.JobStatus) bool
- type Client
- type JobRequest
- type SignalConn
- type UnimplementedWorkerSignalHandler
- func (UnimplementedWorkerSignalHandler) HandleAvailability(*livekit.AvailabilityResponse) error
- func (UnimplementedWorkerSignalHandler) HandleMigrateJob(*livekit.MigrateJobRequest) error
- func (UnimplementedWorkerSignalHandler) HandlePing(*livekit.WorkerPing) error
- func (UnimplementedWorkerSignalHandler) HandleRegister(*livekit.RegisterWorkerRequest) error
- func (UnimplementedWorkerSignalHandler) HandleSimulateJob(*livekit.SimulateJobRequest) error
- func (UnimplementedWorkerSignalHandler) HandleUpdateJob(*livekit.UpdateJobStatus) error
- func (UnimplementedWorkerSignalHandler) HandleUpdateWorker(*livekit.UpdateWorkerStatus) error
- type Worker
- func (w *Worker) AssignJob(ctx context.Context, job *livekit.Job) (*livekit.JobState, error)
- func (w *Worker) Close()
- func (w *Worker) GetJobState(jobID livekit.JobID) (*livekit.JobState, error)
- func (w *Worker) HandleAvailability(res *livekit.AvailabilityResponse) error
- func (w *Worker) HandleMigrateJob(req *livekit.MigrateJobRequest) error
- func (w *Worker) HandleSimulateJob(simulate *livekit.SimulateJobRequest) error
- func (w *Worker) HandleUpdateJob(update *livekit.UpdateJobStatus) error
- func (w *Worker) HandleUpdateWorker(update *livekit.UpdateWorkerStatus) error
- func (w *Worker) IsClosed() bool
- func (w *Worker) Load() float32
- func (w *Worker) Logger() logger.Logger
- func (w *Worker) RunningJobCount() int
- func (w *Worker) RunningJobs() map[livekit.JobID]*livekit.Job
- func (w *Worker) Status() livekit.WorkerStatus
- func (w *Worker) TerminateJob(jobID livekit.JobID, reason rpc.JobTerminateReason) (*livekit.JobState, error)
- func (w *Worker) UpdateJobStatus(update *livekit.UpdateJobStatus) (*livekit.JobState, error)
- func (w *Worker) UpdateMetadata(metadata string)
- type WorkerPingHandler
- type WorkerProtocolVersion
- type WorkerRegisterer
- type WorkerRegistration
- type WorkerSignalHandler
Constants ¶
View Source
const ( EnabledCacheTTL = 1 * time.Minute RoomAgentTopic = "room" PublisherAgentTopic = "publisher" DefaultHandlerNamespace = "" CheckEnabledTimeout = 5 * time.Second )
View Source
const ( RegisterTimeout = 10 * time.Second AssignJobTimeout = 10 * time.Second )
View Source
const CurrentProtocol = 1
Variables ¶
View Source
var ( ErrUnimplementedWrorkerSignal = errors.New("unimplemented worker signal") ErrUnknownWorkerSignal = errors.New("unknown worker signal") ErrUnknownJobType = errors.New("unknown job type") ErrJobNotFound = psrpc.NewErrorf(psrpc.NotFound, "no running job for given jobID") ErrWorkerClosed = errors.New("worker closed") ErrWorkerNotAvailable = errors.New("worker not available") ErrAvailabilityTimeout = errors.New("agent worker availability timeout") ErrDuplicateJobAssignment = errors.New("duplicate job assignment") )
Functions ¶
func DispatchWorkerSignal ¶
func DispatchWorkerSignal(req *livekit.WorkerMessage, h WorkerSignalHandler) error
func GetAgentTopic ¶
func JobStatusIsEnded ¶
Types ¶
type Client ¶
type Client interface { // LaunchJob starts a room or participant job on an agent. // it will launch a job once for each worker in each namespace LaunchJob(ctx context.Context, desc *JobRequest) *serverutils.IncrementalDispatcher[*livekit.Job] TerminateJob(ctx context.Context, jobID string, reason rpc.JobTerminateReason) (*livekit.JobState, error) Stop() error }
func NewAgentClient ¶
func NewAgentClient(bus psrpc.MessageBus) (Client, error)
type JobRequest ¶
type SignalConn ¶
type UnimplementedWorkerSignalHandler ¶
type UnimplementedWorkerSignalHandler struct{}
func (UnimplementedWorkerSignalHandler) HandleAvailability ¶
func (UnimplementedWorkerSignalHandler) HandleAvailability(*livekit.AvailabilityResponse) error
func (UnimplementedWorkerSignalHandler) HandleMigrateJob ¶
func (UnimplementedWorkerSignalHandler) HandleMigrateJob(*livekit.MigrateJobRequest) error
func (UnimplementedWorkerSignalHandler) HandlePing ¶
func (UnimplementedWorkerSignalHandler) HandlePing(*livekit.WorkerPing) error
func (UnimplementedWorkerSignalHandler) HandleRegister ¶
func (UnimplementedWorkerSignalHandler) HandleRegister(*livekit.RegisterWorkerRequest) error
func (UnimplementedWorkerSignalHandler) HandleSimulateJob ¶
func (UnimplementedWorkerSignalHandler) HandleSimulateJob(*livekit.SimulateJobRequest) error
func (UnimplementedWorkerSignalHandler) HandleUpdateJob ¶
func (UnimplementedWorkerSignalHandler) HandleUpdateJob(*livekit.UpdateJobStatus) error
func (UnimplementedWorkerSignalHandler) HandleUpdateWorker ¶
func (UnimplementedWorkerSignalHandler) HandleUpdateWorker(*livekit.UpdateWorkerStatus) error
type Worker ¶
type Worker struct { WorkerPingHandler WorkerRegistration // contains filtered or unexported fields }
func NewWorker ¶
func NewWorker( registration WorkerRegistration, apiKey string, apiSecret string, conn SignalConn, logger logger.Logger, ) *Worker
func (*Worker) GetJobState ¶
func (*Worker) HandleAvailability ¶
func (w *Worker) HandleAvailability(res *livekit.AvailabilityResponse) error
func (*Worker) HandleMigrateJob ¶
func (w *Worker) HandleMigrateJob(req *livekit.MigrateJobRequest) error
func (*Worker) HandleSimulateJob ¶
func (w *Worker) HandleSimulateJob(simulate *livekit.SimulateJobRequest) error
func (*Worker) HandleUpdateJob ¶
func (w *Worker) HandleUpdateJob(update *livekit.UpdateJobStatus) error
func (*Worker) HandleUpdateWorker ¶
func (w *Worker) HandleUpdateWorker(update *livekit.UpdateWorkerStatus) error
func (*Worker) RunningJobCount ¶
func (*Worker) Status ¶
func (w *Worker) Status() livekit.WorkerStatus
func (*Worker) TerminateJob ¶
func (*Worker) UpdateJobStatus ¶
func (*Worker) UpdateMetadata ¶
type WorkerPingHandler ¶
type WorkerPingHandler struct { UnimplementedWorkerSignalHandler // contains filtered or unexported fields }
func (WorkerPingHandler) HandlePing ¶
func (h WorkerPingHandler) HandlePing(ping *livekit.WorkerPing) error
type WorkerProtocolVersion ¶
type WorkerProtocolVersion int
type WorkerRegisterer ¶
type WorkerRegisterer struct { WorkerPingHandler // contains filtered or unexported fields }
func NewWorkerRegisterer ¶
func NewWorkerRegisterer(conn SignalConn, serverInfo *livekit.ServerInfo, protocol WorkerProtocolVersion) *WorkerRegisterer
func (*WorkerRegisterer) Deadline ¶
func (h *WorkerRegisterer) Deadline() time.Time
func (*WorkerRegisterer) HandleRegister ¶
func (h *WorkerRegisterer) HandleRegister(req *livekit.RegisterWorkerRequest) error
func (*WorkerRegisterer) Registered ¶
func (h *WorkerRegisterer) Registered() bool
func (*WorkerRegisterer) Registration ¶
func (h *WorkerRegisterer) Registration() WorkerRegistration
type WorkerRegistration ¶
type WorkerRegistration struct { Protocol WorkerProtocolVersion ID string Version string AgentName string Namespace string JobType livekit.JobType Permissions *livekit.ParticipantPermission }
type WorkerSignalHandler ¶
type WorkerSignalHandler interface { HandleRegister(*livekit.RegisterWorkerRequest) error HandleAvailability(*livekit.AvailabilityResponse) error HandleUpdateJob(*livekit.UpdateJobStatus) error HandleSimulateJob(*livekit.SimulateJobRequest) error HandlePing(*livekit.WorkerPing) error HandleUpdateWorker(*livekit.UpdateWorkerStatus) error HandleMigrateJob(*livekit.MigrateJobRequest) error }
Click to show internal directories.
Click to hide internal directories.