task

package
v0.0.0-...-e417875 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SchedulerCallback ...
	SchedulerCallback = "EXECUTION_SWEEP_CALLBACK"
)

Variables

View Source
var (
	// Ctl is a global task controller instance
	Ctl = NewController()
)
View Source
var (
	// ExecutionCtl is a global execution controller.
	ExecutionCtl = NewExecutionController()
)
View Source
var (
	// SweepCtl is the global sweep controller
	SweepCtl = NewSweepController()
)

Functions

func ScheduleSweepJob

func ScheduleSweepJob(ctx context.Context) error

ScheduleSweepJob schedules the system execution sweep job.

Types

type Controller

type Controller interface {
	// Stop the specified task.
	Stop(ctx context.Context, id int64) (err error)
	// Get the specified task.
	Get(ctx context.Context, id int64) (task *task.Task, err error)
	// List the tasks according to the query.
	List(ctx context.Context, query *q.Query) (tasks []*task.Task, err error)
	// Get the log of the specified task.
	GetLog(ctx context.Context, id int64) (log []byte, err error)
	// Count counts total.
	Count(ctx context.Context, query *q.Query) (int64, error)
}

Controller manages the task

func NewController

func NewController() Controller

NewController creates an instance of the default task controller.

type ExecutionController

type ExecutionController interface {
	// Stop all linked tasks of the specified execution.
	Stop(ctx context.Context, id int64) (err error)
	// Delete the specified execution and its tasks.
	Delete(ctx context.Context, id int64) (err error)
	// Get the specified execution.
	Get(ctx context.Context, id int64) (execution *task.Execution, err error)
	// List executions according to the query.
	List(ctx context.Context, query *q.Query) (executions []*task.Execution, err error)
	// Count counts total.
	Count(ctx context.Context, query *q.Query) (int64, error)
}

ExecutionController manages the execution.

func NewExecutionController

func NewExecutionController() ExecutionController

NewExecutionController creates an instance of the default execution controller.

type SweepController

type SweepController interface {
	Start(ctx context.Context, params *SweepParams, trigger string) error
}

func NewSweepController

func NewSweepController() SweepController

type SweepParams

type SweepParams struct {
	// ExecRetainCounts records the retained execution counts for different vendor type
	ExecRetainCounts map[string]int64
}

Jump to

Keyboard shortcuts

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