task

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const ARWEAVE_PREFIX = "ar://"
View Source
const IPFS_PREFIX = "ipfs://"

Variables

View Source
var (
	// Feature flag whether to use Catalyst's IPFS support or not.
	FlagCatalystSupportsIPFS = false
	// Feature flag whether to use Catalyst for copying source file to object store.
	FlagCatalystCopiesSourceFile = false
	// Feature flag whether Catalyst is able to generate all required probe info.
	FlagCatalystProbesFile = false
)
View Source
var (
	OutputNameOSSourceMP4   = OutputName("source_mp4")
	OutputNameOSPlaylistHLS = OutputName("playlist_hls")
	OutputNameIPFSSourceMP4 = OutputName("ipfs_source_mp4")
)
View Source
var DefaultClient = clients.BaseClient{}
View Source
var ErrYieldExecution = errors.New("yield execution")

Functions

func IsUnretriable

func IsUnretriable(err error) bool

func Prepare added in v0.4.0

func Prepare(tctx *TaskContext, assetSpec *api.AssetSpec, file io.ReadSeekCloser) (string, error)

func TaskExport added in v0.2.0

func TaskExport(tctx *TaskContext) (*data.TaskOutput, error)

func TaskImport

func TaskImport(tctx *TaskContext) (*data.TaskOutput, error)

func TaskTranscode added in v0.3.0

func TaskTranscode(tctx *TaskContext) (*data.TaskOutput, error)

func TaskUpload added in v0.4.17

func TaskUpload(tctx *TaskContext) (*data.TaskOutput, error)

Types

type Accumulator added in v0.4.11

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

func NewAccumulator added in v0.4.11

func NewAccumulator() *Accumulator

func (*Accumulator) Accumulate added in v0.4.11

func (a *Accumulator) Accumulate(size uint64)

func (*Accumulator) Size added in v0.4.11

func (a *Accumulator) Size() uint64

type ExportTaskConfig added in v0.4.5

type ExportTaskConfig struct {
	PinataAccessToken  string
	PlayerImmutableURL *url.URL
	PlayerExternalURL  *url.URL
}

type FileMetadata

type FileMetadata struct {
	AssetSpec      *api.AssetSpec            `json:"assetSpec"`
	MD5            string                    `json:"md5,omitempty"`
	SHA256         string                    `json:"sha256,omitempty"`
	Ffprobe        *ffprobe.ProbeData        `json:"ffprobe,omitempty"`
	CatalystResult *clients.CatalystCallback `json:"catalystResult,omitempty"`
}

func Probe

func Probe(ctx context.Context, assetId, filename string, data *ReadCounter, strict bool) (*FileMetadata, error)

type ImportTaskConfig added in v0.6.0

type ImportTaskConfig struct {
	// Ordered list of IPFS gateways (includes /ipfs/ suffix) to import assets from
	ImportIPFSGatewayURLs []*url.URL
}

type OutputName added in v0.5.0

type OutputName string

type ProgressReporter added in v0.7.0

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

func NewProgressReporter added in v0.7.0

func NewProgressReporter(ctx context.Context, lapi *api.Client, taskID string) *ProgressReporter

func (*ProgressReporter) Set added in v0.7.0

func (p *ProgressReporter) Set(val float64)

func (*ProgressReporter) Stop added in v0.7.0

func (p *ProgressReporter) Stop()

func (*ProgressReporter) Track added in v0.7.0

func (p *ProgressReporter) Track(getProgress func() float64, end float64)

func (*ProgressReporter) TrackCount added in v0.7.0

func (p *ProgressReporter) TrackCount(getCount func() uint64, size uint64, endProgress float64)

func (*ProgressReporter) TrackReader added in v0.7.0

func (p *ProgressReporter) TrackReader(r io.Reader, size uint64, endProgress float64) *ReadCounter

type ReadCounter added in v0.2.0

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

func NewReadCounter added in v0.2.0

func NewReadCounter(r io.Reader) *ReadCounter

func (*ReadCounter) Count added in v0.2.0

func (h *ReadCounter) Count() uint64

func (*ReadCounter) Read added in v0.2.0

func (h *ReadCounter) Read(p []byte) (int, error)

type ReadHasher

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

func NewReadHasher

func NewReadHasher(r io.Reader) *ReadHasher

func (*ReadHasher) FinishReader

func (h *ReadHasher) FinishReader() (int64, error)

func (*ReadHasher) MD5

func (h *ReadHasher) MD5() string

func (*ReadHasher) Read

func (h *ReadHasher) Read(p []byte) (int, error)

func (*ReadHasher) SHA256

func (h *ReadHasher) SHA256() string

type Runner

type Runner interface {
	Start() error
	HandleCatalysis(ctx context.Context, taskId, nextStep string, callback *clients.CatalystCallback) error
	Shutdown(ctx context.Context) error
}

func NewRunner

func NewRunner(opts RunnerOptions) Runner

type RunnerOptions

type RunnerOptions struct {
	AMQPUri                 string
	ExchangeName, QueueName string
	LivepeerAPIOptions      api.ClientOptions
	Catalyst                *clients.CatalystOptions
	ExportTaskConfig
	ImportTaskConfig

	TaskHandlers map[string]TaskHandler
}

type TaskContext

type TaskContext struct {
	context.Context

	data.TaskInfo
	*api.Task
	Progress                *ProgressReporter
	InputAsset, OutputAsset *api.Asset
	InputOSObj, OutputOSObj *api.ObjectStore
	// contains filtered or unexported fields
}

func (TaskContext) HandleCatalysis added in v0.4.17

func (r TaskContext) HandleCatalysis(ctx context.Context, taskId, nextStep string, callback *clients.CatalystCallback) error

func (TaskContext) Shutdown added in v0.2.0

func (r TaskContext) Shutdown(ctx context.Context) error

func (TaskContext) Start added in v0.2.0

func (r TaskContext) Start() error

func (*TaskContext) WithContext added in v0.4.5

func (t *TaskContext) WithContext(ctx context.Context) *TaskContext

type TaskHandler

type TaskHandler func(tctx *TaskContext) (*data.TaskOutput, error)

type UnretriableError

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

func (UnretriableError) Error

func (e UnretriableError) Error() string

func (UnretriableError) Unwrap

func (e UnretriableError) Unwrap() error

type WriteSeekCloser added in v0.3.0

type WriteSeekCloser interface {
	io.WriteSeeker
	io.Closer
	Reader() io.ReadSeekCloser
}

Jump to

Keyboard shortcuts

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