http

package
v0.0.0-...-18e4fd6 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIv1

type APIv1 struct {
	Dir          string
	RunnerName   string
	ControllerIP string
	// contains filtered or unexported fields
}

APIv1 is a struct which implements the runner.Communicator interface using HTTP.

func NewAPIv1

func NewAPIv1(tempDir, runnerName, controllerIP, controllerPort string) (APIv1, error)

NewAPIv1 returns an instantiated ApiV1 struct after creating a proper temporary directory inside of the provided tempDir argument. tempDir will almost always be the result of os.TempDir().

func (*APIv1) SendJobComplete

func (a *APIv1) SendJobComplete(ctx *context.Context, ji runner.JobInfo, cmdR runner.CommandResults) error

SendJobComplete lets the Controller know that the job was completed and sends the resulting file if there is one.

func (*APIv1) SendNewJobRequest

func (a *APIv1) SendNewJobRequest(ctx *context.Context) (runner.JobInfo, error)

SendNewJobRequest requests a new job from the Controller and downloads the file to be worked on. This method blocks the thread until a job is assigned to this Runner.

func (*APIv1) SendStatus

func (a *APIv1) SendStatus(ctx *context.Context, uuid string, js runner.JobStatus) error

SendStatus updates the Controller with the status of the current job.

type AudioTrack

type AudioTrack struct {
	Index    int `json:"index"`
	Channels int `json:"channels"`
}

AudioTrack contains information about a singular audio stream in a media file.

type CurrentTimer

type CurrentTimer interface {
	Now() time.Time
}

CurrentTimer is an interface for abstracting time.Now away from the code for testing purposes.

type FSer

type FSer interface {
	Create(name string) (Filer, error)
	Open(name string) (Filer, error)
}

FSer is a mock interface for the ApiV1 struct which allows file system operations to be mocked out during testing.

type FileMetadata

type FileMetadata struct {
	General        General         `json:"general"`
	VideoTracks    []VideoTrack    `json:"video_tracks"`
	AudioTracks    []AudioTrack    `json:"audio_tracks"`
	SubtitleTracks []SubtitleTrack `json:"subtitle_tracks"`
}

FileMetadata contains information about a video file.

type Filer

type Filer interface {
	io.Closer
	io.Reader
	io.Writer
	Name() string
}

Filer is a mock interface for the ApiV1 struct which allows reading, writing, closing, and naming of a file.

type General

type General struct {
	Duration float32 `json:"duration"`
}

General contains the general information about a media file.

type OsFS

type OsFS struct{}

OsFS is FSer that uses the os package to fulfill the interface requirements.

func (OsFS) Create

func (o OsFS) Create(name string) (Filer, error)

Create wraps os.Create

func (OsFS) Open

func (o OsFS) Open(name string) (Filer, error)

Open wraps os.Open

type RequestDoer

type RequestDoer interface {
	Do(*netHTTP.Request) (*netHTTP.Response, error)
}

RequestDoer is a mock interface for the ApiV1 which allows for mock http Client's to be inserted during testing.

type SubtitleTrack

type SubtitleTrack struct {
	Index    int    `json:"index"`
	Language string `json:"language"`
}

SubtitleTrack contains information about a singular text stream in a media file.

type TimeNow

type TimeNow struct{}

TimeNow uses time.Now to satisfy the CurrentTimer interface.

func (TimeNow) Now

func (t TimeNow) Now() time.Time

Now wraps time.Now

type VideoTrack

type VideoTrack struct {
	Index          int    `json:"index"`
	Codec          string `json:"codec"`
	Bitrate        int    `json:"bitrate"`
	Width          int    `json:"width"`
	Height         int    `json:"height"`
	ColorPrimaries string `json:"color_primaries"`
}

VideoTrack contains information about a singular video stream in a media file.

Jump to

Keyboard shortcuts

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