scheduler

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckInMonitor

type CheckInMonitor interface {
	CheckInName() string
	RecordCheckIn(at time.Time) monitor.RecordResult
	Snapshot() monitor.Snapshot
	Check(now time.Time) monitor.CheckResult
	NextDeadline() (deadline time.Time, active bool)
}

CheckInMonitor exposes the monitor behavior managed by the scheduler.

type MetricsRecorder added in v0.0.11

type MetricsRecorder interface {
	SetMonitorSnapshot(checkIn string, snapshot monitor.Snapshot)
	IncNotificationQueued(checkIn string, status monitor.EventStatus)
	IncNotificationSkipped(checkIn string, status monitor.EventStatus, reason string)
	IncNotificationQueueFailed(checkIn string, status monitor.EventStatus)
}

MetricsRecorder records scheduler-owned monitor and notification metrics.

type NotificationRouter added in v0.0.11

type NotificationRouter interface {
	ReceiverIDsForEvent(event monitor.Event) ([]kit.ReceiverID, bool)
}

NotificationRouter chooses explicit notification receivers for monitor events.

type Scheduler

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

Scheduler advances a check-in monitor and enqueues lifecycle notifications.

func New

func New(
	monitor CheckInMonitor,
	notifier kit.Notifier,
	router NotificationRouter,
	registry MetricsRecorder,
	logger *slog.Logger,
) *Scheduler

New creates a scheduler for a check-in monitor and notifykit manager.

func (*Scheduler) Check

func (s *Scheduler) Check(ctx context.Context, now time.Time)

Check advances the monitor and enqueues due lifecycle events.

func (*Scheduler) CheckInName

func (s *Scheduler) CheckInName() string

CheckInName returns the configured check-in monitor name.

func (*Scheduler) RecordCheckIn

func (s *Scheduler) RecordCheckIn(at time.Time) monitor.RecordResult

RecordCheckIn records a check-in and enqueues any resolved notification.

func (*Scheduler) RecordCheckInContext added in v0.0.11

func (s *Scheduler) RecordCheckInContext(ctx context.Context, at time.Time) monitor.RecordResult

RecordCheckInContext records a check-in and uses ctx when enqueueing any resolved notification.

func (*Scheduler) Run

func (s *Scheduler) Run(ctx context.Context)

Run starts the scheduler loop in a background goroutine.

func (*Scheduler) Snapshot

func (s *Scheduler) Snapshot() monitor.Snapshot

Snapshot returns the current check-in monitor state.

Jump to

Keyboard shortcuts

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