schedule

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionModeStateless = capschedule.SessionModeStateless
	SessionModeReuse     = capschedule.SessionModeReuse
	SessionModeFresh     = capschedule.SessionModeFresh
	SessionModeFixed     = capschedule.SessionModeFixed
)

Variables

This section is empty.

Functions

func FireMeta

func FireMeta(metadata map[string]any) (map[string]any, bool)

func InFlightExpired

func InFlightExpired(job capsschedule.Job, now time.Time) bool

InFlightExpired reports whether a claimed one-shot should be reclaimed.

func IsFireStateless

func IsFireStateless(metadata map[string]any) bool

func IsFireTurn

func IsFireTurn(metadata map[string]any) bool

func IsOneShot

func IsOneShot(job capsschedule.Job) bool

IsOneShot reports whether a job fires once at an absolute time.

func IsStatelessSessionMode

func IsStatelessSessionMode(mode string) bool

func JobKind

func JobKind(job capsschedule.Job) string

JobKind returns the normalized job kind.

func NextFire

func NextFire(job capsschedule.Job, after time.Time) (time.Time, bool)

NextFire reports when a job should next run, given its anchor.

func SessionModeFromMeta

func SessionModeFromMeta(meta map[string]any) string

Types

type Schedule

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

Schedule is a parsed cron expression. Times are interpreted in the location of whatever time.Time it is asked about, so a schedule built from local time behaves like an OS crontab entry.

func ParseCron

func ParseCron(expr string) (Schedule, error)

ParseCron parses a 5-field cron expression: minute hour day-of-month month day-of-week. Each field accepts `*`, a number, `a-b`, comma-separated lists, and `*/n` or `a-b/n` steps. The @hourly/@daily/@weekly/@monthly/@yearly shorthands are also accepted.

func (Schedule) Matches

func (s Schedule) Matches(t time.Time) bool

Matches reports whether t (to the minute) satisfies the schedule.

func (Schedule) Next

func (s Schedule) Next(t time.Time) (time.Time, bool)

Next returns the first matching minute strictly after t. The second result is false when nothing matches within the search horizon, which only happens for impossible dates such as "0 0 30 2 *".

func (Schedule) String

func (s Schedule) String() string

Jump to

Keyboard shortcuts

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