executor

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultExecutor

type DefaultExecutor struct {
	// contains filtered or unexported fields
}

DefaultExecutor is our concrete implementation of JobExecutor

func NewExecutor

func NewExecutor(handlers map[string]JobHandler) *DefaultExecutor

NewExecutor creates an executor with the given handlers. If handlers is nil, an empty map will be initialized for the registry.

func (*DefaultExecutor) Execute

func (e *DefaultExecutor) Execute(ctx context.Context, job db.Job) error

Execute implements the JobExecutor interface

func (*DefaultExecutor) Register

func (e *DefaultExecutor) Register(jobType string, handler JobHandler)

Register adds a new handler for a specific job type. It overwrites any existing handler for the same job type.

type JobExecutor

type JobExecutor interface {
	Execute(ctx context.Context, job db.Job) error // Changed to db.Job
	Register(jobType string, handler JobHandler)
}

JobExecutor defines the interface for executing jobs and registering handlers.

type JobHandler

type JobHandler interface {
	Handle(ctx context.Context, job db.Job) error // Changed to db.Job
}

JobHandler processes a specific type of job

Jump to

Keyboard shortcuts

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