scheduler

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromJobs

func FromJobs(jobs []*cronext.Job) []interface{}

FromJobs converts []*cronext.Job to []interface{}

func ToJob

func ToJob(v interface{}) *cronext.Job

ToJob converts interface{} to *cronext.Job

func ToJobs

func ToJobs(v []interface{}) []*cronext.Job

ToJobs converts []interface{} to []*cronext.Job

Types

type DistributedScheduler

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

DistributedScheduler implements a distributed scheduler with leader election. This is a placeholder implementation that needs to be completed.

func NewDistributedScheduler

func NewDistributedScheduler(
	config cronext.Config,
	storage cronext.Storage,
	executor *cronext.Executor,
	registry *cronext.JobRegistry,
	logger forge.Logger,
) (*DistributedScheduler, error)

NewDistributedScheduler creates a new distributed scheduler. TODO: Implement full distributed scheduler with consensus extension integration.

func (*DistributedScheduler) AddJob

func (s *DistributedScheduler) AddJob(jobInterface interface{}) error

AddJob adds a job to the scheduler.

func (*DistributedScheduler) GetJob

func (s *DistributedScheduler) GetJob(jobID string) (interface{}, error)

GetJob retrieves a job by ID.

func (*DistributedScheduler) IsLeader

func (s *DistributedScheduler) IsLeader() bool

IsLeader returns whether this node is the leader.

func (*DistributedScheduler) IsRunning

func (s *DistributedScheduler) IsRunning() bool

IsRunning returns whether the scheduler is running.

func (*DistributedScheduler) ListJobs

func (s *DistributedScheduler) ListJobs() ([]interface{}, error)

ListJobs lists all jobs.

func (*DistributedScheduler) RemoveJob

func (s *DistributedScheduler) RemoveJob(jobID string) error

RemoveJob removes a job from the scheduler.

func (*DistributedScheduler) Start

func (s *DistributedScheduler) Start(ctx context.Context) error

Start starts the distributed scheduler.

func (*DistributedScheduler) Stop

Stop stops the distributed scheduler.

func (*DistributedScheduler) TriggerJob

func (s *DistributedScheduler) TriggerJob(ctx context.Context, jobID string) (string, error)

TriggerJob manually triggers a job execution.

func (*DistributedScheduler) UpdateJob

func (s *DistributedScheduler) UpdateJob(jobInterface interface{}) error

UpdateJob updates a job in the scheduler.

type SimpleScheduler

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

SimpleScheduler implements a single-node scheduler using robfig/cron. This scheduler runs on a single instance without distributed coordination.

func NewSimpleScheduler

func NewSimpleScheduler(
	config cronext.Config,
	storage cronext.Storage,
	executor *cronext.Executor,
	registry *cronext.JobRegistry,
	logger forge.Logger,
) (*SimpleScheduler, error)

NewSimpleScheduler creates a new simple scheduler.

func (*SimpleScheduler) AddJob

func (s *SimpleScheduler) AddJob(jobInterface interface{}) error

AddJob adds a job to the scheduler.

func (*SimpleScheduler) GetJob

func (s *SimpleScheduler) GetJob(jobID string) (interface{}, error)

GetJob retrieves a job by ID.

func (*SimpleScheduler) IsLeader

func (s *SimpleScheduler) IsLeader() bool

IsLeader always returns true for simple scheduler (no distributed coordination).

func (*SimpleScheduler) IsRunning

func (s *SimpleScheduler) IsRunning() bool

IsRunning returns whether the scheduler is running.

func (*SimpleScheduler) ListJobs

func (s *SimpleScheduler) ListJobs() ([]interface{}, error)

ListJobs lists all jobs.

func (*SimpleScheduler) RemoveJob

func (s *SimpleScheduler) RemoveJob(jobID string) error

RemoveJob removes a job from the scheduler.

func (*SimpleScheduler) Start

func (s *SimpleScheduler) Start(ctx context.Context) error

Start starts the scheduler and loads jobs from storage.

func (*SimpleScheduler) Stop

func (s *SimpleScheduler) Stop(ctx context.Context) error

Stop stops the scheduler gracefully.

func (*SimpleScheduler) TriggerJob

func (s *SimpleScheduler) TriggerJob(ctx context.Context, jobID string) (string, error)

TriggerJob manually triggers a job execution.

func (*SimpleScheduler) UpdateJob

func (s *SimpleScheduler) UpdateJob(jobInterface interface{}) error

UpdateJob updates a job in the scheduler.

Jump to

Keyboard shortcuts

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