Documentation
¶
Index ¶
Constants ¶
View Source
const (
// PeriodicExecutionMark marks the scheduled job to a periodic execution
PeriodicExecutionMark = "_job_kind_periodic_"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Policy ¶ added in v1.8.0
type Policy struct {
// Policy can be treated as job template of periodic job.
// The info of policy will be copied into the scheduled job executions for the periodic job.
ID string `json:"id"`
JobName string `json:"job_name"`
CronSpec string `json:"cron_spec"`
JobParameters map[string]interface{} `json:"job_params,omitempty"`
WebHookURL string `json:"web_hook_url,omitempty"`
}
Policy ...
func (*Policy) DeSerialize ¶ added in v1.8.0
DeSerialize the raw json to policy.
type Scheduler ¶ added in v1.8.0
type Scheduler interface {
// Start to serve periodic job scheduling process
//
// Returns:
// error if any problems happened
Start() error
// Stop the working periodic job scheduling process
//
// Returns;
// error if any problems happened
Stop() error
// Schedule the specified cron job policy.
//
// policy *Policy : The job template of the scheduling periodical jobs
//
// Returns:
// int64 the numeric id of policy
// error if failed to schedule
Schedule(policy *Policy) (int64, error)
// Unschedule the specified cron job policy.
//
// policyID string: The ID of cron job policy.
//
// Return:
// error if failed to unschedule
UnSchedule(policyID string) error
}
Scheduler defines operations the periodic scheduler should have.
func NewScheduler ¶ added in v1.8.0
func NewScheduler(ctx context.Context, namespace string, pool *redis.Pool, ctl lcm.Controller) Scheduler
NewScheduler is constructor of basicScheduler
Click to show internal directories.
Click to hide internal directories.