task

package
v0.0.0-...-742e869 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Deadline     time.Duration
	DialTimeout  time.Duration
	MaxIdleConns int
}

Config config

type CreateTaskReq

type CreateTaskReq struct {
	Title      string `json:"title"`
	Describe   string `json:"describe"`
	Type       int    `json:"type"`
	TimeBar    string `json:"timeBar"`
	State      int    `json:"state"`
	Code       string `json:"code"`
	Retry      int    `json:"retry"`
	RetryDelay int64  `json:"retryDelay"`
}

CreateTaskReq 添加任务[参数]

type CreateTaskResp

type CreateTaskResp struct{}

CreateTaskResp 添加任务[返回值]

type HTTPHandOut

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

HTTPHandOut restful的方式分发

func NewHTTPHandOut

func NewHTTPHandOut(conf *Config) *HTTPHandOut

NewHTTPHandOut new restful HandOut

func (*HTTPHandOut) HandOut

func (h *HTTPHandOut) HandOut(ctx context.Context, taskLine *models.TaskLine) error

HandOut 分发

type Processor

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

Processor 处理器

func NewProcessor

func NewProcessor(ctx context.Context, conf *config.Config) (*Processor, error)

NewProcessor new a

func (*Processor) Close

func (p *Processor) Close() error

Close close

func (*Processor) DO

func (p *Processor) DO(c context.Context)

DO 事物处理

func (*Processor) Monitor

func (p *Processor) Monitor(c context.Context) error

Monitor 内置消息监听器 监听分布式消息通知

func (*Processor) Reset

func (p *Processor) Reset(ctx context.Context)

Reset 重置

type Task

type Task interface {
	// 添加任务
	CreateTask(ctx context.Context, req *CreateTaskReq) (*CreateTaskReq, error)
	// UpdateTaskState 修改任务
	UpdateTask(ctx context.Context, req *UpdateTaskReq) (*UpdateTaskResp, error)
	// UpdateTaskState 修改任务状态
	UpdateTaskState(ctx context.Context, req *UpdateTaskStateReq) (*UpdateTaskStateResp, error)
}

Task task

func NewTask

func NewTask(conf *config.Config) (Task, error)

NewTask new task

type UpdateTaskReq

type UpdateTaskReq struct {
	TaskID     string `json:"taskID"`
	Code       string `json:"code"`
	Title      string `json:"title"`
	Describe   string `json:"describe"`
	Type       int    `json:"type"`
	TimeBar    string `json:"timeBar"`
	Retry      int    `json:"retry"`
	RetryDelay int    `json:"retryDelay"`
}

UpdateTaskReq 修改任务[参数]

type UpdateTaskResp

type UpdateTaskResp struct{}

UpdateTaskResp 修改任务[返回值]

type UpdateTaskStateReq

type UpdateTaskStateReq struct {
	TaskID string `json:"taskID"`
	Code   string `json:"code"`
	State  int    `json:"state"`
}

UpdateTaskStateReq 修改任务状态[参数]

type UpdateTaskStateResp

type UpdateTaskStateResp struct{}

UpdateTaskStateResp 修改任务状态[返回值]

Jump to

Keyboard shortcuts

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