internal

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvServerPort       = "VT_SERVER_PORT"
	EnvDatabaseHost     = "VT_DB_HOST"
	EnvDatabasePort     = "VT_DB_PORT"
	EnvDatabaseUser     = "VT_DB_USER"
	EnvDatabasePassword = "VT_DB_PASSWORD"
	EnvDatabaseName     = "VT_DB_NAME"
)

Variables

View Source
var (
	ErrPanicEnvNotSet = errors.New("environment variable not set")
	ErrPanicEnvNotInt = errors.New("environment variable is not an integer")
)
View Source
var ErrPanicInvalidProfile = errors.New("invalid profile")

Functions

func MigrateDown

func MigrateDown(ctx context.Context, pool *pgxpool.Pool) error

MigrateDown rolls back all migrations (both application and River migrations). It acquires a postgres advisory lock to prevent concurrent migrations.

func MigrateUp

func MigrateUp(ctx context.Context, pool *pgxpool.Pool) error

MigrateUp runs all pending migrations (both River and application migrations). It acquires a postgres advisory lock to prevent concurrent migrations.

func NewDBPool

func NewDBPool(ctx context.Context, cfg *DatabaseConfig) (*pgxpool.Pool, error)

NewDBPool creates a new pgxpool.Pool from the given DatabaseConfig.

Types

type DatabaseConfig

type DatabaseConfig struct {
	Host     string
	Port     int
	User     string
	Password string
	Name     string
}

type Profile added in v0.0.5

type Profile string
const ProfileFast1080p30 Profile = "fast1080p30"
const ProfilePreview Profile = "preview"

func (Profile) IsValid added in v0.0.5

func (p Profile) IsValid() bool

type ProgressCallback added in v0.0.5

type ProgressCallback func(progress float64)

type ServerConfig

type ServerConfig struct {
	Port     int
	Database *DatabaseConfig
}

ServerConfig contains configuration for the HTTP server.

func NewServerConfigFromEnv

func NewServerConfigFromEnv() *ServerConfig

type TranscodeJobArgs

type TranscodeJobArgs struct {
	UUID                uuid.UUID `json:"uuid"`
	SourcePath          string    `json:"sourcePath"`
	DestinationPath     string    `json:"destinationPath"`
	Profile             Profile   `json:"profile"`
	WebhookURI          *string   `json:"webhookUri,omitempty"`
	WebhookToken        []byte    `json:"webhookToken,omitempty"`
	HeartbeatWebhookURI *string   `json:"heartbeatWebhookUri,omitempty"`
}

TranscodeJobArgs contains the arguments for a transcode job. This is used as the River job args payload.

func (TranscodeJobArgs) Kind

func (TranscodeJobArgs) Kind() string

Kind returns the job kind identifier for River.

type TranscodeJobStatus

type TranscodeJobStatus struct {
	// Progress is the transcoding progress percentage (0-100).
	Progress float64 `json:"progress"`
	// Error contains an error message if the job failed.
	Error *string `json:"error,omitempty"`
}

TranscodeJobStatus represents the current status of a transcode job. This is stored as River job output via river.RecordOutput() and can be read by both server and worker.

type TranscodeParams added in v0.0.5

type TranscodeParams struct {
	SourcePath       string
	DestinationPath  string
	ProgressCallback ProgressCallback
}

type Transcoder added in v0.0.5

type Transcoder interface {
	Transcode(context.Context, TranscodeParams) error
}

func NewTranscoder added in v0.0.5

func NewTranscoder(profile Profile) Transcoder

type WebhookJobArgs added in v0.0.4

type WebhookJobArgs struct {
	URI         string              `json:"uri"`
	Token       []byte              `json:"token,omitempty"`
	UUID        uuid.UUID           `json:"uuid"`
	Status      *TranscodeJobStatus `json:"status,omitempty"`
	IsHeartbeat bool                `json:"isHeartbeat,omitempty"`
}

WebhookJobArgs contains the arguments for a webhook notification job.

func (WebhookJobArgs) Kind added in v0.0.4

func (WebhookJobArgs) Kind() string

Kind returns the job kind identifier for River.

type WorkerConfig

type WorkerConfig struct {
	Database *DatabaseConfig
}

WorkerConfig contains configuration for the worker.

func NewWorkerConfigFromEnv

func NewWorkerConfigFromEnv() *WorkerConfig

Jump to

Keyboard shortcuts

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