task

package
v0.0.0-...-83a686f Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {

	// Create returns s a Task based on the passed-in NewTask
	//
	// Never pass a nil here; it's a pointer because the struct isn't small
	Create(ctx context.Context, newTask *task.NewTask) (*task.Task, *common.ApiError)

	// Get returns a Task based on the passed in queue and taskId
	Get(ctx context.Context, queue queue.Name, taskId domainTask.Id) (*task.Task, *common.ApiError)

	// Claim attempts to claim a number of tasks for te given workerId, blocking for a certain amount of time.
	Claim(ctx context.Context, workerId worker.Id, queues []queue.Name, number uint, blockFor time.Duration) ([]task.Task, *common.ApiError)

	// ReportIn files a report on a running Task owned by a worker identified by the given workerId
	ReportIn(ctx context.Context, workerId worker.Id, queue queue.Name, taskId domainTask.Id, report task.NewReport) (*task.Task, *common.ApiError)

	// MarkDone marks a Task as Done.
	MarkDone(ctx context.Context, workerId worker.Id, queue queue.Name, taskId domainTask.Id, success *domainTask.Success) (*task.Task, *common.ApiError)

	// MarkFailed marks a Task as failed.
	MarkFailed(ctx context.Context, workerId worker.Id, queue queue.Name, taskId domainTask.Id, success *domainTask.Failure) (*task.Task, *common.ApiError)

	// Unclaim puts a Task that currently belongs to a worker with the given workerId back on the work queue
	UnClaim(ctx context.Context, workerId worker.Id, queue queue.Name, taskId domainTask.Id) (*task.Task, *common.ApiError)
}

Controller is an interface that defines the methods that are available to the routing layer. It is framework-agnostic

func New

func New(tasksService domainTask.Service, tasksConfig config.TasksDefaults) Controller

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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