period

package
v1.8.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2019 License: Apache-2.0 Imports: 17 Imported by: 3

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

func (p *Policy) DeSerialize(rawJSON []byte) error

DeSerialize the raw json to policy.

func (*Policy) Serialize added in v1.8.0

func (p *Policy) Serialize() ([]byte, error)

Serialize the policy to raw data.

func (*Policy) Validate added in v1.8.0

func (p *Policy) Validate() error

Validate the 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL