Documentation ¶
Index ¶
- type Baask8sJobContext
- type Baask8sJobRunner
- type CHLPayload
- type JobScheduler
- func (scheduler *JobScheduler) ScheduleJob(runner baasapi.JobRunner) error
- func (scheduler *JobScheduler) Start()
- func (scheduler *JobScheduler) UnscheduleJob(scheduleID baasapi.ScheduleID)
- func (scheduler *JobScheduler) UpdateJobSchedule(runner baasapi.JobRunner) error
- func (scheduler *JobScheduler) UpdateSystemJobSchedule(jobType baasapi.JobType, newCronExpression string) error
- type SnapshotJobContext
- type SnapshotJobRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Baask8sJobContext ¶
type Baask8sJobContext struct {
// contains filtered or unexported fields
}
Baask8sJobContext represents the context of execution of a Baask8sJob
func NewBaask8sJobContext ¶
func NewBaask8sJobContext(baask8sService baasapi.Baask8sService, cafilesmanager baasapi.CAFilesManager) *Baask8sJobContext
NewBaask8sJobContext returns a new context that can be used to execute a Baask8sJob func NewBaask8sJobContext(baask8sService baasapi.Baask8sService, baask8ster baasapi.Baask8ster) *Baask8sJobContext {
type Baask8sJobRunner ¶
type Baask8sJobRunner struct {
// contains filtered or unexported fields
}
Baask8sJobRunner is used to run a Baask8sJob
func NewBaask8sJobRunner ¶
func NewBaask8sJobRunner(schedule *baasapi.Schedule, context *Baask8sJobContext) *Baask8sJobRunner
NewBaask8sJobRunner returns a new runner that can be scheduled
func (*Baask8sJobRunner) GetSchedule ¶
func (runner *Baask8sJobRunner) GetSchedule() *baasapi.Schedule
GetSchedule returns the schedule associated to the runner
func (*Baask8sJobRunner) Run ¶
func (runner *Baask8sJobRunner) Run()
Run triggers the execution of the schedule. It will iterate through all the baask8ss available in the database to create a snapshot of each one of them. As a snapshot can be a long process, to avoid any concurrency issue we retrieve the latest version of the baask8s right after a snapshot.
type CHLPayload ¶
type CHLPayload struct { Allchannels []baasapi.CHL Currchannels []baasapi.CHL }
type JobScheduler ¶
type JobScheduler struct {
// contains filtered or unexported fields
}
JobScheduler represents a service for managing crons
func NewJobScheduler ¶
func NewJobScheduler() *JobScheduler
NewJobScheduler initializes a new service
func (*JobScheduler) ScheduleJob ¶
func (scheduler *JobScheduler) ScheduleJob(runner baasapi.JobRunner) error
ScheduleJob schedules the execution of a job via a runner
func (*JobScheduler) UnscheduleJob ¶
func (scheduler *JobScheduler) UnscheduleJob(scheduleID baasapi.ScheduleID)
UnscheduleJob remove a scheduled job by re-creating a new cron and adding all the existing jobs except for the one specified via scheduleID. NOTE: the cron library do not support removing schedules directly hence the work-around
func (*JobScheduler) UpdateJobSchedule ¶
func (scheduler *JobScheduler) UpdateJobSchedule(runner baasapi.JobRunner) error
UpdateJobSchedule updates a specific scheduled job by re-creating a new cron and adding all the existing jobs. It will then re-schedule the new job via the specified JobRunner parameter. NOTE: the cron library do not support updating schedules directly hence the work-around
func (*JobScheduler) UpdateSystemJobSchedule ¶
func (scheduler *JobScheduler) UpdateSystemJobSchedule(jobType baasapi.JobType, newCronExpression string) error
UpdateSystemJobSchedule updates the first occurence of the specified scheduled job based on the specified job type. It does so by re-creating a new cron and adding all the existing jobs. It will then re-schedule the new job with the update cron expression passed in parameter. NOTE: the cron library do not support updating schedules directly hence the work-around
type SnapshotJobContext ¶
type SnapshotJobContext struct {
// contains filtered or unexported fields
}
SnapshotJobContext represents the context of execution of a SnapshotJob
func NewSnapshotJobContext ¶
func NewSnapshotJobContext(baask8sService baasapi.Baask8sService, snapshotter baasapi.Snapshotter) *SnapshotJobContext
NewSnapshotJobContext returns a new context that can be used to execute a SnapshotJob
type SnapshotJobRunner ¶
type SnapshotJobRunner struct {
// contains filtered or unexported fields
}
SnapshotJobRunner is used to run a SnapshotJob
func NewSnapshotJobRunner ¶
func NewSnapshotJobRunner(schedule *baasapi.Schedule, context *SnapshotJobContext) *SnapshotJobRunner
NewSnapshotJobRunner returns a new runner that can be scheduled
func (*SnapshotJobRunner) GetSchedule ¶
func (runner *SnapshotJobRunner) GetSchedule() *baasapi.Schedule
GetSchedule returns the schedule associated to the runner
func (*SnapshotJobRunner) Run ¶
func (runner *SnapshotJobRunner) Run()
Run triggers the execution of the schedule. It will iterate through all the baask8ss available in the database to create a snapshot of each one of them. As a snapshot can be a long process, to avoid any concurrency issue we retrieve the latest version of the baask8s right after a snapshot.