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
- Variables
- func AutoRetryWithConfig[T any](ctx context.Context, logger logging.Logger, t *TaskConfig, ...) (T, error)
- func AutoRetryWithTask[T any](t *RunningTask, supplier func() (T, error)) (T, error)
- func GenerateFileName(roomName string, t time.Time) string
- type DownloadConfig
- type RunningTask
- type TaskConfig
- type TaskResult
- type TaskStatus
- type TransportConfig
- type WatchConfig
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 AutoRetryWithTask ¶ added in v0.3.3
func AutoRetryWithTask[T any]( t *RunningTask, supplier func() (T, error), ) (T, error)
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"`
}
Click to show internal directories.
Click to hide internal directories.