async

package
v1.14.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskRegisterStatus = "register"
	TaskRunningStatus  = "running"
	TaskFinishStatus   = "finish"
	TaskErrorStatus    = "error"
	TaskCancelStatus   = "cancel"
)

Variables

This section is empty.

Functions

func InitManager

func InitManager() error

Types

type AsyncManager

type AsyncManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}
var GlobalAsyncManager *AsyncManager

func (*AsyncManager) CancelTask

func (m *AsyncManager) CancelTask(taskID string) error

func (*AsyncManager) FinishTask

func (m *AsyncManager) FinishTask(taskID, msg string) error

func (*AsyncManager) GetTask

func (m *AsyncManager) GetTask(taskID string) (*AsyncTaskStatus, error)

func (*AsyncManager) GetTaskIDList

func (m *AsyncManager) GetTaskIDList() ([]string, error)

func (*AsyncManager) RegisterTask

func (m *AsyncManager) RegisterTask(taskID string) (context.Context, error)

func (*AsyncManager) StartTask

func (m *AsyncManager) StartTask(taskID string) error

func (*AsyncManager) TaskFailed

func (m *AsyncManager) TaskFailed(taskID string, errMsg error) error

type AsyncTaskStatus

type AsyncTaskStatus struct {
	TaskID           string `json:"id"`
	Status           string `json:"status"`
	Message          string `json:"message"`
	CreatedTimestamp int64  `json:"createdTimestamp"`
	UpdatedTimestamp int64  `json:"updatedTimestamp"`
}

Jump to

Keyboard shortcuts

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