Documentation
¶
Index ¶
- func New(sch schcli.Client, chat chatcli.Client) (schapi.Client, error)
- func NewFromEnv(ctx context.Context) (schapi.Client, error)
- type Service
- func (s *Service) GetRuns(ctx context.Context, scheduleID, since string, session ...codec.SessionOption) ([]*schapi.Run, error)
- func (s *Service) GetSchedule(ctx context.Context, id string, session ...codec.SessionOption) (*schapi.Schedule, error)
- func (s *Service) ListSchedules(ctx context.Context, session ...codec.SessionOption) ([]*schapi.Schedule, error)
- func (s *Service) Run(ctx context.Context, in *schapi.MutableRun) error
- func (s *Service) RunDue(ctx context.Context) (int, error)
- func (s *Service) Schedule(ctx context.Context, in *schapi.MutableSchedule) error
- type Watchdog
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements client/scheduler.Client by delegating persistence to the schedule store and optionally enriching runs with a created conversation via chat when missing.
func (*Service) GetRuns ¶
func (s *Service) GetRuns(ctx context.Context, scheduleID, since string, session ...codec.SessionOption) ([]*schapi.Run, error)
GetRuns lists runs for a schedule, optionally filtered by since id.
func (*Service) GetSchedule ¶
func (s *Service) GetSchedule(ctx context.Context, id string, session ...codec.SessionOption) (*schapi.Schedule, error)
GetSchedule returns a schedule by id or nil if not found.
func (*Service) ListSchedules ¶
func (s *Service) ListSchedules(ctx context.Context, session ...codec.SessionOption) ([]*schapi.Schedule, error)
ListSchedules returns all schedules.
func (*Service) Run ¶
Run creates or updates a run, optionally creating a conversation using chat when ConversationId is missing.
type Watchdog ¶ added in v0.2.2
type Watchdog struct {
// Errors receives errors encountered during RunDue calls. It is buffered
// and non-blocking; consumers may choose to drain it for diagnostics.
Errors chan error
// contains filtered or unexported fields
}
Watchdog encapsulates a background ticker that periodically invokes scheduler.Client.RunDue to trigger due runs. Call Stop to cancel.
func StartWatchdog ¶ added in v0.2.2
StartWatchdog launches a background goroutine that calls RunDue on the provided scheduler client at the specified interval. If interval <= 0, a default of 30s is used. The returned Watchdog can be stopped via Stop().