middleware

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoordinatingTaskService

type CoordinatingTaskService struct {
	taskmodel.TaskService
	// contains filtered or unexported fields
}

CoordinatingTaskService acts as a TaskService decorator that handles coordinating the api request with the required task control actions asynchronously via a message dispatcher

func New

func New(service taskmodel.TaskService, coordinator Coordinator) *CoordinatingTaskService

New constructs a new coordinating task service

func (*CoordinatingTaskService) CancelRun

func (s *CoordinatingTaskService) CancelRun(ctx context.Context, taskID, runID platform.ID) error

CancelRun Cancel the run and publish the cancellation.

func (*CoordinatingTaskService) CreateTask

CreateTask Creates a task in the existing task service and Publishes the change so any TaskD service can lease it.

func (*CoordinatingTaskService) DeleteTask

func (s *CoordinatingTaskService) DeleteTask(ctx context.Context, id platform.ID) error

DeleteTask delete the task and publishes the change, to allow the task owner to find out about this change faster.

func (*CoordinatingTaskService) ForceRun

func (s *CoordinatingTaskService) ForceRun(ctx context.Context, taskID platform.ID, scheduledFor int64) (*taskmodel.Run, error)

ForceRun create the forced run in the task system and publish to the pubSub.

func (*CoordinatingTaskService) RetryRun

func (s *CoordinatingTaskService) RetryRun(ctx context.Context, taskID, runID platform.ID) (*taskmodel.Run, error)

RetryRun calls retry on the task service and publishes the retry.

func (*CoordinatingTaskService) UpdateTask

UpdateTask Updates a task and publishes the change so the task owner can act on the update

type Coordinator

type Coordinator interface {
	TaskCreated(context.Context, *taskmodel.Task) error
	TaskUpdated(ctx context.Context, from, to *taskmodel.Task) error
	TaskDeleted(context.Context, platform.ID) error
	RunCancelled(ctx context.Context, runID platform.ID) error
	RunRetried(ctx context.Context, task *taskmodel.Task, run *taskmodel.Run) error
	RunForced(ctx context.Context, task *taskmodel.Task, run *taskmodel.Run) error
}

Coordinator is a type which is used to react to task related actions

Jump to

Keyboard shortcuts

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