Documentation
¶
Index ¶
- Constants
- Variables
- func MigrateDown(ctx context.Context, pool *pgxpool.Pool) error
- func MigrateUp(ctx context.Context, pool *pgxpool.Pool) error
- func NewDBPool(ctx context.Context, cfg *DatabaseConfig) (*pgxpool.Pool, error)
- type DatabaseConfig
- type Profile
- type ProgressCallback
- type ServerConfig
- type TranscodeJobArgs
- type TranscodeJobStatus
- type TranscodeParams
- type Transcoder
- type WebhookJobArgs
- type WorkerConfig
Constants ¶
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 ¶
var ( ErrPanicEnvNotSet = errors.New("environment variable not set") ErrPanicEnvNotInt = errors.New("environment variable is not an integer") )
var ErrPanicInvalidProfile = errors.New("invalid profile")
Functions ¶
func MigrateDown ¶
MigrateDown rolls back all migrations (both application and River migrations). It acquires a postgres advisory lock to prevent concurrent migrations.
Types ¶
type DatabaseConfig ¶
type Profile ¶ added in v0.0.5
type Profile string
const ProfileFast1080p30 Profile = "fast1080p30"
const ProfilePreview Profile = "preview"
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