scheduler

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package scheduler provides user-managed cron schedules that trigger workflow executions. It generalizes the built-in cron with a schedules table, HTTP API, CLI commands, and a background ticker that evaluates due schedules every 60s.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() plugin.Plugin

New creates a new Plugin instance.

Types

type Plugin

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

Plugin implements user-managed cron schedules with tenant isolation.

func (*Plugin) Info

func (p *Plugin) Info() plugin.PluginInfo

Info returns plugin metadata for discovery and documentation.

func (*Plugin) Init

func (p *Plugin) Init(ctx context.Context, env *plugin.Environment) error

Init initializes the plugin with the given environment.

func (*Plugin) Migrations

func (p *Plugin) Migrations() []plugin.Migration

Migrations returns the database schema for the schedules table. Tables are idempotent (IF NOT EXISTS) and safe to run multiple times.

func (*Plugin) RegisterCommands

func (p *Plugin) RegisterCommands() []plugin.Command

RegisterCommands returns the CLI subcommands for the scheduler plugin.

func (*Plugin) RegisterHostFunctions

func (p *Plugin) RegisterHostFunctions(scope plugin.FuncRegistry) error

RegisterHostFunctions registers workflow-callable functions for the scheduler plugin. Currently, the scheduler does not expose any host functions to workflows; this method is a no-op that validates the registry is non-nil.

func (*Plugin) RegisterRoutes

func (p *Plugin) RegisterRoutes(mux *http.ServeMux) error

func (*Plugin) Run

func (p *Plugin) Run(ctx context.Context) error

Run starts the background scheduler loop. Every 60 seconds it queries the schedules table for enabled schedules whose next_run_at <= now() and triggers the corresponding workflow. Returns when ctx is cancelled.

Jump to

Keyboard shortcuts

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