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 MockScheduler ¶
MockScheduler is an autogenerated mock type for the Scheduler type
func NewMockScheduler ¶
func NewMockScheduler(t interface { mock.TestingT Cleanup(func()) }) *MockScheduler
NewMockScheduler creates a new instance of MockScheduler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockScheduler) Schedule ¶
func (_m *MockScheduler) Schedule(policy *Policy) (int64, error)
Schedule provides a mock function with given fields: policy
func (*MockScheduler) Start ¶
func (_m *MockScheduler) Start()
Start provides a mock function with given fields:
func (*MockScheduler) UnSchedule ¶
func (_m *MockScheduler) UnSchedule(policyID string) error
UnSchedule provides a mock function with given fields: policyID
type Policy ¶
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"` NumericID int64 `json:"numeric_id,omitempty"` }
Policy ...
func (*Policy) DeSerialize ¶
DeSerialize the raw json to policy.
type Scheduler ¶
type Scheduler interface { // Start to serve periodic job scheduling process // Start() // 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 ¶
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.