job

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WorkerModuleName     = dep.Name("wk", "job", "worker")
	ControllerModuleName = dep.Name("wk", "job", "controller")
)

Functions

func ControllerModule

func ControllerModule(opts ...Option) dep.Module

func WorkerModule

func WorkerModule(opts ...Option) dep.Module

Types

type Api

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

func (*Api) CancelTask

func (a *Api) CancelTask(ctx context.Context, request *CancelTaskRequest) (*CancelTaskResponse, error)

func (*Api) CreateTask

func (a *Api) CreateTask(ctx context.Context, request *CreateTaskRequest) (*CreateTaskResponse, error)

func (*Api) ListWorkers

func (a *Api) ListWorkers(ctx context.Context, request *ListWorkerRequest) (*ListWorkerResponse, error)

type CancelTaskRequest

type CancelTaskRequest struct {
	TaskID xid.ID `path:"task_id"`
}

type CancelTaskResponse

type CancelTaskResponse struct{}

type CreateTaskRequest

type CreateTaskRequest struct {
	Name        string      `body:"name"`
	Args        interface{} `body:"args"`
	ContentType string      `body:"contentType"`
}

type CreateTaskResponse

type CreateTaskResponse struct {
	TaskID xid.ID `json:"taskID"`
}

type ListWorkerRequest

type ListWorkerRequest struct{}

type ListWorkerResponse

type ListWorkerResponse struct {
	Workers []ListWorkerResponseItem `json:"workers"`
}

type ListWorkerResponseItem

type ListWorkerResponseItem struct {
	ID              string           `json:"id"`
	LastUpdate      time.Time        `json:"lastUpdate"`
	RegisteredTasks []string         `json:"registeredTasks"`
	Load            map[string]int32 `json:"load"`
}

type Option

type Option func(options *Options)

func WithTasks

func WithTasks(tasks ...task.Task) Option

type Options

type Options struct {
	Tasks []task.Task
}

Jump to

Keyboard shortcuts

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