croner

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CronScheduleStreamName = "CRON_SCHEDULE"

	CronScheduleSubject events.Subject = "cron_schedule"
	CronScheduleTopic   events.Topic   = "schedule"
	CronCompleteTopic   events.Topic   = "complete"
)

Variables

View Source
var AgentModule = fx.Module("cron",
	fx.Provide(
		NewAgent,
	),
)
View Source
var ErrInvalidCronSyntax = errors.New("invalid cron syntax")
View Source
var HandlerModule = fx.Module("cron_handlers",
	fx.Provide(
		NewHandlers,
	),
)
View Source
var Module = fx.Module("cron",
	fx.Provide(
		New,
	),
)
View Source
var SchedulerModule = fx.Module("cron_scheduler",
	fx.Provide(
		NewScheduler,
	),
)

Functions

This section is empty.

Types

type Agent

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

func NewAgent

func NewAgent(p AgentParams) (*Agent, error)

type AgentParams

type AgentParams struct {
	fx.In

	LC fx.Lifecycle

	Logger *zap.Logger
	JS     *events.JSWrapper

	Handlers *Handlers
}

type Cron

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

func (*Cron) RegisterCronjob

func (c *Cron) RegisterCronjob(ctx context.Context, job *cron.Cronjob) error

func (*Cron) UnregisterCronjob

func (c *Cron) UnregisterCronjob(ctx context.Context, name string) error

type CronjobHandlerFn

type CronjobHandlerFn func(ctx context.Context, data *cron.CronjobData) error

type Handlers

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

func NewHandlers

func NewHandlers(logger *zap.Logger) *Handlers

func (*Handlers) Add

func (h *Handlers) Add(name string, fn CronjobHandlerFn)

func (*Handlers) Remove

func (h *Handlers) Remove(name string)

type ICron

type ICron interface {
	RegisterCronjob(ctx context.Context, job *cron.Cronjob) error
	UnregisterCronjob(ctx context.Context, name string) error
}

func New

func New(p Params) (ICron, error)

func NewNoopCron

func NewNoopCron() ICron

type NoopCron

type NoopCron struct {
	ICron
}

func (*NoopCron) RegisterCronjob

func (c *NoopCron) RegisterCronjob(ctx context.Context, job *cron.Cronjob) error

func (*NoopCron) UnregisterCronjob

func (c *NoopCron) UnregisterCronjob(ctx context.Context, name string) error

type Params

type Params struct {
	fx.In

	LC fx.Lifecycle

	Logger    *zap.Logger
	Cfg       *config.Config
	JS        *events.JSWrapper
	Scheduler *Scheduler
}

type Scheduler

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

func NewScheduler

func NewScheduler(p SchedulerParams) (*Scheduler, error)

type SchedulerParams

type SchedulerParams struct {
	fx.In

	LC fx.Lifecycle

	Logger *zap.Logger
	JS     *events.JSWrapper
}

Jump to

Keyboard shortcuts

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