task

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	CreateTask(ctx context.Context, req *taskspb.CreateTaskRequest, opts ...gax.CallOption) (*taskspb.Task, error)
	Close() error
}

type Payload

type Payload struct {
	Url    string `json:"url"`    // the youtube url to use for download
	Artist string `json:"artist"` // the artist
	Album  string `json:"album"`  // the album
	Track  string `json:"track"`  // the music track
}

Payload contains the needed fields to perform the download.

type Provider

type Provider interface {
	NewClient() (Client, error)
}

type Task

type Task struct {
	JobKey string `json:"job_key"`
	Payload
}

Task is the payload sent to the download job.

type TaskClient

type TaskClient interface {

	// CreateTask creates a new task from the given payload.
	// It returns the created task.
	CreateTask(tPayload Task) (*taskspb.Task, error)

	// Close closes the client
	Close() error
}

TaskClient is responsible for creating tasks in Cloud Task.

func NewTaskClient

func NewTaskClient(opt TaskClientOptions) (TaskClient, error)

NewTaskClient is the builder for the TaskClient

type TaskClientOptions

type TaskClientOptions struct {
	// QueuePath locates where to push new tasks.
	QueuePath string

	// Target is the host that needs to be called by the task.
	Target string

	// Provider for the client
	Provider Provider
}

TaskClientOptions are the options for the TaskClient builder.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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