db

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompleteEncodeTaskParams

type CompleteEncodeTaskParams struct {
	AssetID pgtype.UUID `json:"asset_id"`
	Lane    string      `json:"lane"`
	Chunk   int32       `json:"chunk"`
}

type CreateEncodeTaskParams

type CreateEncodeTaskParams struct {
	AssetID pgtype.UUID `json:"asset_id"`
	JobID   pgtype.UUID `json:"job_id"`
	Lane    string      `json:"lane"`
	Chunk   int32       `json:"chunk"`
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type EncodeTasksLeftRow

type EncodeTasksLeftRow struct {
	PlayableLeft int32 `json:"playable_left"`
	AllLeft      int32 `json:"all_left"`
}

type ListEncodeTasksRow

type ListEncodeTasksRow struct {
	Lane      string             `json:"lane"`
	Chunk     int32              `json:"chunk"`
	Done      bool               `json:"done"`
	Attempts  int32              `json:"attempts"`
	Node      string             `json:"node"`
	Progress  float32            `json:"progress"`
	LastError string             `json:"last_error"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
	StartedAt pgtype.Timestamptz `json:"started_at"`
	DoneAt    pgtype.Timestamptz `json:"done_at"`
	State     string             `json:"state"`
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) CompleteEncodeTask

func (q *Queries) CompleteEncodeTask(ctx context.Context, arg CompleteEncodeTaskParams) (string, error)

func (*Queries) CreateEncodeTask

func (q *Queries) CreateEncodeTask(ctx context.Context, arg CreateEncodeTaskParams) error

func (*Queries) DeleteEncodeTasks

func (q *Queries) DeleteEncodeTasks(ctx context.Context, assetID pgtype.UUID) error

func (*Queries) EncodeTasksLeft

func (q *Queries) EncodeTasksLeft(ctx context.Context, assetID pgtype.UUID) (EncodeTasksLeftRow, error)

func (*Queries) ListEncodeTasks

func (q *Queries) ListEncodeTasks(ctx context.Context, assetID pgtype.UUID) ([]ListEncodeTasksRow, error)

func (*Queries) LockTasks

func (q *Queries) LockTasks(ctx context.Context, assetID pgtype.UUID) (int32, error)

Finishers of one video's pieces take turns, so the last one to finish is the only one to queue packaging.

func (*Queries) TaskProgress

func (q *Queries) TaskProgress(ctx context.Context, assetIds []pgtype.UUID) ([]TaskProgressRow, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

func (*Queries) WriteOffTasks

func (q *Queries) WriteOffTasks(ctx context.Context, assetID pgtype.UUID) error

A video that failed has no more work to hand out.

type TaskProgressRow

type TaskProgressRow struct {
	AssetID pgtype.UUID `json:"asset_id"`
	Lane    string      `json:"lane"`
	Done    int32       `json:"done"`
	Total   int32       `json:"total"`
	Partial float64     `json:"partial"`
}

Jump to

Keyboard shortcuts

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