Help us shape the future of Go! Take the 2026 Go Developer Survey

recording

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

This file contains task runner. Task runner composes status monitor and stream downloader concrete task config. The config can be load from a config file.

Index

Constants

View Source
const (
	CommandLiveStart       = "LIVE"
	CommandStreamPreparing = "PREPARING"
)
View Source
const SpecialExtName = "partial"

Variables

View Source
var (
	ErrTaskIsAlreadyStarted = fmt.Errorf("task is already started")
	ErrTaskIsStopped        = fmt.Errorf("restarting a stopped task is not allowed")
)

Functions

func AutoRetryWithConfig added in v0.3.3

func AutoRetryWithConfig[T any](
	ctx context.Context,
	logger logging.Logger,
	t *TaskConfig,
	supplier func() (T, error),
) (T, error)

func AutoRetryWithTask added in v0.3.3

func AutoRetryWithTask[T any](
	t *RunningTask,
	supplier func() (T, error),
) (T, error)

func GenerateFileName

func GenerateFileName(roomName string, t time.Time) string

Types

type DownloadConfig

type DownloadConfig struct {
	SaveDirectory                    string `mapstructure:"save_directory"`
	DiskWriteBufferBytes             int64  `mapstructure:"disk_write_buffer_bytes"`
	UseSpecialExtNameBeforeFinishing bool   `mapstructure:"use_special_ext_name_when_downloading"`
}

func (DownloadConfig) String

func (d DownloadConfig) String() string

type RunningTask

type RunningTask struct {
	TaskConfig
	// contains filtered or unexported fields
}

RunningTask is an augmented TaskConfig struct that contains volatile runtime information.

func NewRunningTask

func NewRunningTask(
	config TaskConfig,
	ctx context.Context,
	hookStarted func(),
	hookStopped func(),
	logger logging.Logger,
) RunningTask

func (*RunningTask) StartTask

func (t *RunningTask) StartTask() error

type TaskConfig

type TaskConfig struct {
	RoomId    types.RoomId    `mapstructure:"room_id"`
	Transport TransportConfig `mapstructure:"transport"`
	Download  DownloadConfig  `mapstructure:"download"`
	Watch     WatchConfig     `mapstructure:"watch"`
}

func (TaskConfig) String

func (t TaskConfig) String() string

type TaskResult

type TaskResult struct {
	Task  *TaskConfig
	Error error
}

TaskResult represents an execution result of a task.

type TaskStatus

type TaskStatus int
const (
	StNotStarted TaskStatus = iota
	StRunning
	StRestarting
	StStopped
)

type TransportConfig

type TransportConfig struct {
	SocketTimeoutSeconds int               `mapstructure:"socket_timeout_seconds"`
	RetryIntervalSeconds int               `mapstructure:"retry_interval_seconds"`
	MaxRetryTimes        int               `mapstructure:"max_retry_times"`
	AllowedNetworkTypes  []types.IpNetType `mapstructure:"allowed_network_types"`
}

func DefaultTransportConfig

func DefaultTransportConfig() TransportConfig

func (TransportConfig) String

func (t TransportConfig) String() string

type WatchConfig

type WatchConfig struct {
	LiveInterruptedRestartSleepSeconds int `mapstructure:"live_interrupted_restart_sleep_seconds"`
}

Jump to

Keyboard shortcuts

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