scheduler

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Overview

Package scheduler provides portable scheduled-command tool coordination.

Index

Constants

View Source
const (
	ActionAdd    = "add"
	ActionList   = "list"
	ActionStatus = "status"
	ActionRun    = "run"
	ActionRemove = "remove"
)
View Source
const Name = "cron"

Name is the catalog name of the scheduled-command tool.

Variables

This section is empty.

Functions

func Definition

func Definition() toolcontract.Definition

Definition returns the stable scheduled-command tool schema.

func NewHandler

func NewHandler(backend Backend) toolcontract.Handler

NewHandler constructs deterministic action routing over the Host backend.

func Register

func Register(reg toolcontract.Registrar, backend Backend)

Register adds the scheduled-command tool when a Backend is available.

Types

type Backend

Backend owns concrete scheduler, task/session store, authorization, visibility and durable-write behavior.

type BackendFuncs

type BackendFuncs struct {
	AddFunc    func(context.Context, Request) (string, error)
	ListFunc   func(context.Context, Request) (string, error)
	StatusFunc func(context.Context, Request) (string, error)
	RunFunc    func(context.Context, Request) (string, error)
	RemoveFunc func(context.Context, Request) (string, error)
}

BackendFuncs adapts private Host functions to Backend.

func (BackendFuncs) Add

func (b BackendFuncs) Add(ctx context.Context, request Request) (string, error)

func (BackendFuncs) List

func (b BackendFuncs) List(ctx context.Context, request Request) (string, error)

func (BackendFuncs) Remove

func (b BackendFuncs) Remove(ctx context.Context, request Request) (string, error)

func (BackendFuncs) Run

func (b BackendFuncs) Run(ctx context.Context, request Request) (string, error)

func (BackendFuncs) Status

func (b BackendFuncs) Status(ctx context.Context, request Request) (string, error)

type Request

type Request struct {
	Action    string
	Arguments map[string]any
}

Request is a normalized scheduled command. Arguments is a defensive copy of the accepted JSON object so a Host can apply its product-specific policy.

Jump to

Keyboard shortcuts

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