Documentation
¶
Index ¶
- type Config
- type Loader
- type Scheduler
- func (s *Scheduler) AddSchedule(ctx context.Context, schedule *loomv1.ScheduledWorkflow) error
- func (s *Scheduler) GetHistory(ctx context.Context, scheduleID string, limit int) ([]*loomv1.ScheduleExecution, error)
- func (s *Scheduler) GetSchedule(ctx context.Context, scheduleID string) (*loomv1.ScheduledWorkflow, error)
- func (s *Scheduler) ListSchedules(ctx context.Context) ([]*loomv1.ScheduledWorkflow, error)
- func (s *Scheduler) PauseSchedule(ctx context.Context, scheduleID string) error
- func (s *Scheduler) RemoveSchedule(ctx context.Context, scheduleID string) error
- func (s *Scheduler) ResumeSchedule(ctx context.Context, scheduleID string) error
- func (s *Scheduler) Start(ctx context.Context) error
- func (s *Scheduler) Stop(ctx context.Context) error
- func (s *Scheduler) TriggerNow(ctx context.Context, scheduleID string, skipIfRunning bool, ...) (string, error)
- func (s *Scheduler) UpdateSchedule(ctx context.Context, schedule *loomv1.ScheduledWorkflow) error
- type Store
- func (s *Store) Close() error
- func (s *Store) Create(ctx context.Context, schedule *loomv1.ScheduledWorkflow) error
- func (s *Store) Delete(ctx context.Context, id string) error
- func (s *Store) Get(ctx context.Context, id string) (*loomv1.ScheduledWorkflow, error)
- func (s *Store) GetDueSchedules(ctx context.Context, currentTime int64) ([]*loomv1.ScheduledWorkflow, error)
- func (s *Store) GetExecutionHistory(ctx context.Context, scheduleID string, limit int) ([]*loomv1.ScheduleExecution, error)
- func (s *Store) IncrementSkipped(ctx context.Context, scheduleID string) error
- func (s *Store) List(ctx context.Context) ([]*loomv1.ScheduledWorkflow, error)
- func (s *Store) RecordExecution(ctx context.Context, exec *loomv1.ScheduleExecution, scheduleID string) error
- func (s *Store) RecordFailure(ctx context.Context, scheduleID, errorMsg string) error
- func (s *Store) RecordSuccess(ctx context.Context, scheduleID string) error
- func (s *Store) Update(ctx context.Context, schedule *loomv1.ScheduledWorkflow) error
- func (s *Store) UpdateCurrentExecution(ctx context.Context, scheduleID, executionID string) error
- func (s *Store) UpdateNextExecution(ctx context.Context, scheduleID string, nextExecution int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
WorkflowDir string
DBPath string
Orchestrator *orchestration.Orchestrator
Registry *agent.Registry
Tracer observability.Tracer
Logger *zap.Logger
HotReload bool
}
Config contains scheduler configuration.
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader loads workflow YAML files with schedule sections and manages hot-reload.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler manages cron-based workflow execution.
func NewScheduler ¶
NewScheduler creates a new workflow scheduler.
func (*Scheduler) AddSchedule ¶
AddSchedule adds a new scheduled workflow.
func (*Scheduler) GetHistory ¶
func (s *Scheduler) GetHistory(ctx context.Context, scheduleID string, limit int) ([]*loomv1.ScheduleExecution, error)
GetHistory retrieves execution history for a schedule.
func (*Scheduler) GetSchedule ¶
func (s *Scheduler) GetSchedule(ctx context.Context, scheduleID string) (*loomv1.ScheduledWorkflow, error)
GetSchedule retrieves a schedule by ID.
func (*Scheduler) ListSchedules ¶
ListSchedules returns all schedules.
func (*Scheduler) PauseSchedule ¶
PauseSchedule disables a schedule without removing it.
func (*Scheduler) RemoveSchedule ¶
RemoveSchedule removes a schedule from the scheduler.
func (*Scheduler) ResumeSchedule ¶
ResumeSchedule re-enables a paused schedule.
func (*Scheduler) TriggerNow ¶
func (s *Scheduler) TriggerNow(ctx context.Context, scheduleID string, skipIfRunning bool, variables map[string]string) (string, error)
TriggerNow manually triggers a scheduled workflow immediately.
func (*Scheduler) UpdateSchedule ¶
UpdateSchedule updates an existing schedule.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists scheduled workflows and execution history to SQLite. Uses WAL mode for concurrent read/write access.
func NewStore ¶
NewStore creates a new scheduler store with SQLite backend. The dbPath should point to ~/.loom/scheduler.db.
func (*Store) GetDueSchedules ¶
func (s *Store) GetDueSchedules(ctx context.Context, currentTime int64) ([]*loomv1.ScheduledWorkflow, error)
GetDueSchedules returns all schedules that should execute now. A schedule is due if its next_execution_at is <= current time and it's enabled.
func (*Store) GetExecutionHistory ¶
func (s *Store) GetExecutionHistory(ctx context.Context, scheduleID string, limit int) ([]*loomv1.ScheduleExecution, error)
GetExecutionHistory retrieves execution history for a schedule.
func (*Store) IncrementSkipped ¶
IncrementSkipped increments the skipped execution counter.
func (*Store) RecordExecution ¶
func (s *Store) RecordExecution(ctx context.Context, exec *loomv1.ScheduleExecution, scheduleID string) error
RecordExecution stores an execution record for audit trail.
func (*Store) RecordFailure ¶
RecordFailure increments failed execution count and stores error.
func (*Store) RecordSuccess ¶
RecordSuccess increments successful execution count and updates stats.
func (*Store) UpdateCurrentExecution ¶
UpdateCurrentExecution sets or clears the current execution ID for a schedule.