scheduler

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExecutorNotDefined = errors.New("executor not defined for this task")

Functions

This section is empty.

Types

type Driver

type Driver interface {
	ScheduleTask(ctx context.Context, task string, scheduleAt time.Time, payload []byte) error
	Start(ctx context.Context) <-chan error
	RegisterExecutor(task string, executor JobExecutor)
}

func NewDiscard

func NewDiscard() Driver

func NewScheduler

func NewScheduler(storage Storage, runEvery time.Duration, concurrency int) Driver

type JobExecutor

type JobExecutor func(ctx context.Context, payload []byte) error

type Storage

type Storage interface {
	Store(ctx context.Context, taskName string, scheduleAt time.Time, payload []byte) error
	Retrieve(ctx context.Context) (taskID, taskName string, data []byte, err error)
	Failure(ctx context.Context, taskID string) error
	Done(ctx context.Context, taskID string) error
}

func NewFileScheduler added in v1.3.1

func NewFileScheduler() Storage

func NewRedisStorage

func NewRedisStorage(client *redis.Client) Storage

func NewSQLStorage

func NewSQLStorage(db *sqlx.DB) Storage

Jump to

Keyboard shortcuts

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