Documentation
¶
Overview ¶
Package schedule implements all the scheduling of jobs. The approach used to implement is the same as the http golang library style. We have Schedulers that will be executed (Run method). We have SchedulerFunc that is a wrap of a function to convert it to an schedule object and be able to run. like http middlewares, we create schedulers with functions that receive other schedulers as parameters and create a chain (schedule/chain)
Package schedule contains all the logic to execute the jobs
Index ¶
- type Cron
- type Scheduler
- func DummyRun(exitStatus int, result string) Scheduler
- func DummyScheduler(exitStatus int, resultOut string, s Scheduler) Scheduler
- func HTTPScheduler(timeout time.Duration, s Scheduler) Scheduler
- func LogScheduler(s Scheduler) Scheduler
- func SimpleRun() Scheduler
- func TimingScheduler(s Scheduler) Scheduler
- type SchedulerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cron ¶
type Cron struct {
// Results is a blocking channel where the crons will post their results as
// a notification event of finished (ideally the actions of a finish result should
// be in the chain of the scheduler (see `scheduler/run`)
Results chan *job.Result
// contains filtered or unexported fields
}
Cron is be the registerer of jobs
func NewDummyCron ¶
NewDummyCron creates a new instance of a cron that will execute dummy jobs (do nothing) when the time comes
func NewSimpleCron ¶
NewSimpleCron creates a new instance of a cron initialized with the basic functionality
func (*Cron) RegisterCronJob ¶
RegisterCronJob registers a cron to be run when its it's time
type Scheduler ¶
Scheduler implements the unit of execution of a job, it mus implement run method this method will be the one that will execute job logic
func DummyScheduler ¶
DummyScheduler breaks the schedule chain and returns an specific result
func HTTPScheduler ¶
HTTPScheduler makes an http call to the job destination and registers the result http executed jobs should return 200 if job went ok and 500 if it went wrong, everything else will be interpreted as unknown
func LogScheduler ¶
LogScheduler logs the execution of a job
func SimpleRun ¶
func SimpleRun() Scheduler
SimpleRun has the simples execution flow of a job, log, time, and http
func TimingScheduler ¶
TimingScheduler registers the start and finish time of a job