runner_manager

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRunner = errors.New("no runner is available")

ErrNoRunner is returned when no runner is alive and accepting jobs.

Functions

func GenerateSectionImages added in v1.8.0

func GenerateSectionImages(m *Manager, req SectionImageRequest, fallback func() error) error

GenerateSectionImages generates the thumbnails for the given video sections.

Section image generation is being moved from the workers to the runners. Until every deployment runs runners, fallback - the legacy worker path - is used whenever no runner takes the job. m may be nil when no runner manager is configured.

Types

type CamService added in v1.7.0

type CamService interface {
	For(address string, cameraType model.CameraType) (camera.Cam, error)
}

type LiveStateNotifier added in v1.7.9

type LiveStateNotifier func(streamID uint, live bool)

LiveStateNotifier is called whenever a stream transitions into or out of the live state, so that other parts of the application (e.g. the websocket hub) can react to it.

type Manager

type Manager struct {
	protobuf.UnimplementedRunnerManagerServiceServer
	// contains filtered or unexported fields
}

Manager manages communication with runners and handles job distribution

func New

func New(dao dao.DaoWrapper, opts ...Option) *Manager

New returns a new instance of Manager with the given Options

func (*Manager) EndStream added in v1.7.9

func (m *Manager) EndStream(ctx context.Context, streamID uint, discardVoD bool) error

EndStream cancels all runner jobs tracked for the given stream, e.g. when an admin manually stops a stream. It is a no-op if no runner jobs are tracked for the stream (e.g. because it is running on a legacy worker instead).

func (*Manager) Notify

func (m *Manager) Notify(ctx context.Context, notification *protobuf.Notification) (*protobuf.NotificationResponse, error)

func (*Manager) ReapStaleStreams added in v1.7.9

func (m *Manager) ReapStaleStreams()

ReapStaleStreams finds streams that are stuck in live state and cleans them up. This handles the case where the runner crashes and can never deliver StreamEndNotification.

func (*Manager) Register

func (*Manager) RequestRegenerateThumbnail added in v1.10.0

func (m *Manager) RequestRegenerateThumbnail(ctx context.Context, req RegenerateThumbnailRequest) error

RequestRegenerateThumbnail asks a runner to regenerate the thumbnail for an already-recorded VOD. The runner answers asynchronously with a ThumbnailReadyNotification, which saveThumbnail then stores, so this returns as soon as the job is accepted.

func (*Manager) RequestSectionImages added in v1.8.0

func (m *Manager) RequestSectionImages(ctx context.Context, req SectionImageRequest) error

RequestSectionImages asks a runner to generate thumbnails for the given video sections. The runner answers asynchronously with a SectionImagesReadyNotification, which saveSectionImages then stores, so this returns as soon as the job is accepted.

func (*Manager) RequestSelfStream added in v1.5.7

func (m *Manager) RequestSelfStream(ctx context.Context, stream model.Stream) error

func (*Manager) RequestUpload added in v1.11.0

func (m *Manager) RequestUpload(ctx context.Context, streamID uint, version model.StreamVersion) (UploadSlot, error)

RequestUpload reserves a runner for an upload of one version of a stream's VOD. The caller sends the file to the returned slot; the runner then converts it and reports the result in a VODReadyNotification and a ThumbnailReadyNotification, which the manager stores like those of a recorded stream.

func (*Manager) Run

func (m *Manager) Run() error

func (*Manager) TriggerDueStreams

func (m *Manager) TriggerDueStreams() error

func (*Manager) UpdateLights added in v1.7.5

func (m *Manager) UpdateLights()

type Option

type Option func(m *Manager)

Option is a func that applies configuration to the Manager

func WithCamService added in v1.7.0

func WithCamService(camService CamService) Option

func WithListenAddr

func WithListenAddr(addr string) Option

WithListenAddr sets the address the Manager listens on for gRPC connections from the Runner. If not applied, the default is used (:50056)

func WithLiveStateNotifier added in v1.7.9

func WithLiveStateNotifier(notifier LiveStateNotifier) Option

WithLiveStateNotifier registers a callback invoked when a stream starts or stops being live, e.g. to notify viewers via websocket.

func WithMassStorage added in v1.5.7

func WithMassStorage(path string) Option

func WithSubtitleClient added in v1.5.7

func WithSubtitleClient(client pb.SubtitleGeneratorClient, auth string) Option

type RegenerateThumbnailRequest added in v1.10.0

type RegenerateThumbnailRequest struct {
	StreamID    uint
	Version     model.StreamVersion
	PlaylistURL string
}

RegenerateThumbnailRequest describes the VOD whose thumbnail should be regenerated. PlaylistURL must be signed, as for SectionImageRequest.

type SectionImageRequest added in v1.8.0

type SectionImageRequest struct {
	StreamID    uint
	PlaylistURL string
	Sections    []model.VideoSection
}

SectionImageRequest describes the video sections of a stream that need a thumbnail.

type UploadSlot added in v1.11.0

type UploadSlot struct {
	// Host and Port are the runner's HTTP upload endpoint.
	Host string
	Port int
	// Token is single use and only valid for a short time.
	Token string
}

UploadSlot is where and how one video file can be sent to a runner.

Jump to

Keyboard shortcuts

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