sched

package
v0.0.0-...-b044761 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pause

func Pause()

Pause stops the sched timing

func Resume

func Resume()

Resume resumes sched and start executing tasks this is a pair call with Pause(), Resume() must be called second

func Stop

func Stop()

Stop stops runtime scheduler gracefully. Note that the call should only be called then application terminates

func Wait

func Wait()

Wait waits all tasks to be scheduled.

Types

type Task

type Task interface {
	// GetID must returns a unique ID for all of the scheduled task.
	GetID() (id string)
	// GetExecution returns the time for task execution.
	GetExecution() (execute time.Time)
	// GetRetryTime returns the retry time if a task was failed.
	GetRetryTime() (execute time.Time)
	// Execute executes the actual task, it can return a result,
	// or if the task need a retry, or it was failed in this execution.
	Execute() (result interface{}, retry bool, fail error)
}

Task interface for sched

type TaskFuture

type TaskFuture interface {
	Get() interface{}
}

TaskFuture is the future of Task execution

func Submit

func Submit(t Task) TaskFuture

Submit given tasks

func Trigger

func Trigger(t Task) TaskFuture

Trigger given tasks immediately

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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