taskengine

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

type Task interface {
	Run()
}

Task define the task interface

type TaskEngine

type TaskEngine struct {
	sync.WaitGroup
	// contains filtered or unexported fields
}

TaskEngine define the task engine

func New

func New(ctx context.Context, name string, concurrencyLevel int, logger *zap.Logger) *TaskEngine

New create a new task engine

func (*TaskEngine) Schedule

func (engine *TaskEngine) Schedule(task Task) bool

Schedule schedule a task running on engine

func (*TaskEngine) Shutdown

func (engine *TaskEngine) Shutdown()

Shutdown stop the task engine

type TaskFunc

type TaskFunc func()

TaskFunc define the task func type

func (TaskFunc) Run

func (f TaskFunc) Run()

Run implements the Task interface

Jump to

Keyboard shortcuts

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