services

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskService

type TaskService interface {
	Create(owner string, taskQueue string, timeout int32, retry int32, payload string, notBefore int64) (string, error)
	Select(taskID string) error
	Fail(taskID string) error
	Cancel(taskID string) error
	Timeout(taskID string) error
	Complete(taskID string, result string) error
	Delete(taskID string) error
	ConsumeQueueResult(queue string) (*domain.Task, error)
}

TaskService is a service to manage tasks

type TaskServiceImpl

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

TaskServiceImpl is an implementation of TaskService

func NewTaskService

func NewTaskService(repository repository.TaskRepository, view view.TaskView, resultExpiration int) TaskServiceImpl

NewTaskService creates a new TaskService

func (TaskServiceImpl) Cancel

func (s TaskServiceImpl) Cancel(taskID string) error

Cancel marks a task as canceled

func (TaskServiceImpl) Complete

func (s TaskServiceImpl) Complete(taskID string, result string) error

Complete marks a task as completed

func (TaskServiceImpl) ConsumeQueueResult added in v1.2.0

func (s TaskServiceImpl) ConsumeQueueResult(queue string) (*domain.Task, error)

ConsumeQueueResult consumes a "finished" item from the given queue "finished" items have state "completed", "timedout" or "failed"

func (TaskServiceImpl) Create

func (s TaskServiceImpl) Create(owner string, taskQueue string, timeout int32, retry int32, payload string, notBefore int64) (string, error)

Create creates a new task from given arguments

func (TaskServiceImpl) Delete

func (s TaskServiceImpl) Delete(taskID string) error

Delete deletes a task

func (TaskServiceImpl) Fail

func (s TaskServiceImpl) Fail(taskID string) error

Fail marks a task as failed

func (TaskServiceImpl) Select

func (s TaskServiceImpl) Select(taskID string) error

Select marks a task as selected

func (TaskServiceImpl) Timeout

func (s TaskServiceImpl) Timeout(taskID string) error

Timeout marks a task as timedout

type TaskServiceInstrumenter added in v1.2.0

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

############################################################################

Instrumenting Middleware

############################################################################

func NewTaskServiceInstrumenter added in v1.2.0

func NewTaskServiceInstrumenter(counter *kitprometheus.Counter, next TaskService) TaskServiceInstrumenter

func (TaskServiceInstrumenter) Cancel added in v1.2.0

func (l TaskServiceInstrumenter) Cancel(taskID string) error

func (TaskServiceInstrumenter) Complete added in v1.2.0

func (l TaskServiceInstrumenter) Complete(taskID string, result string) error

func (TaskServiceInstrumenter) ConsumeQueueResult added in v1.2.0

func (l TaskServiceInstrumenter) ConsumeQueueResult(queue string) (*domain.Task, error)

func (TaskServiceInstrumenter) Create added in v1.2.0

func (l TaskServiceInstrumenter) Create(owner string, taskQueue string, timeout int32, retry int32, payload string, notBefore int64) (string, error)

func (TaskServiceInstrumenter) Delete added in v1.2.0

func (l TaskServiceInstrumenter) Delete(taskID string) error

func (TaskServiceInstrumenter) Fail added in v1.2.0

func (l TaskServiceInstrumenter) Fail(taskID string) error

func (TaskServiceInstrumenter) Select added in v1.2.0

func (l TaskServiceInstrumenter) Select(taskID string) error

func (TaskServiceInstrumenter) Timeout added in v1.2.0

func (l TaskServiceInstrumenter) Timeout(taskID string) error

type TaskServiceLocker

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

############################################################################

Locking Middleware

############################################################################

func NewTaskServiceLocker

func NewTaskServiceLocker(locker *redislock.Client, next TaskService) TaskServiceLocker

func (TaskServiceLocker) Cancel

func (l TaskServiceLocker) Cancel(taskID string) error

func (TaskServiceLocker) Complete

func (l TaskServiceLocker) Complete(taskID string, result string) error

func (TaskServiceLocker) ConsumeQueueResult added in v1.2.0

func (l TaskServiceLocker) ConsumeQueueResult(queue string) (*domain.Task, error)

func (TaskServiceLocker) Create

func (l TaskServiceLocker) Create(owner string, taskQueue string, timeout int32, retry int32, payload string, notBefore int64) (string, error)

func (TaskServiceLocker) Delete

func (l TaskServiceLocker) Delete(taskID string) error

func (TaskServiceLocker) Fail

func (l TaskServiceLocker) Fail(taskID string) error

func (TaskServiceLocker) Select

func (l TaskServiceLocker) Select(taskID string) error

func (TaskServiceLocker) Timeout

func (l TaskServiceLocker) Timeout(taskID string) error

type TaskServiceLogger

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

############################################################################

Logging Middleware

############################################################################

func NewTaskServiceLogger

func NewTaskServiceLogger(logger log.Logger, next TaskService) TaskServiceLogger

func (TaskServiceLogger) Cancel

func (l TaskServiceLogger) Cancel(taskID string) error

func (TaskServiceLogger) Complete

func (l TaskServiceLogger) Complete(taskID string, result string) error

func (TaskServiceLogger) ConsumeQueueResult added in v1.2.0

func (l TaskServiceLogger) ConsumeQueueResult(queue string) (*domain.Task, error)

func (TaskServiceLogger) Create

func (l TaskServiceLogger) Create(owner string, taskQueue string, timeout int32, retry int32, payload string, notBefore int64) (string, error)

func (TaskServiceLogger) Delete

func (l TaskServiceLogger) Delete(taskID string) error

func (TaskServiceLogger) Fail

func (l TaskServiceLogger) Fail(taskID string) error

func (TaskServiceLogger) Select

func (l TaskServiceLogger) Select(taskID string) error

func (TaskServiceLogger) Timeout

func (l TaskServiceLogger) Timeout(taskID string) error

type TaskTimeoutService

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

TaskTimeoutService is a service to manage task timeouts

func NewTaskTimeoutService

func NewTaskTimeoutService(service TaskService, view view.TaskView) TaskTimeoutService

NewTaskTimeoutService creates a new TaskTimeoutService

func (TaskTimeoutService) TimeoutTasks

func (s TaskTimeoutService) TimeoutTasks() error

TimeoutTasks make all needed tasks to timeout

Jump to

Keyboard shortcuts

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