Documentation
¶
Index ¶
Constants ¶
const ( CronMinutely = "* * * * *" CronHourly = "0 * * * *" CronDaily = "0 0 * * *" CronMonthly = "0 0 0 1 * * *" CronEveryFiveMinutes = "*/5 * * * *" CronEveryFifteenMinutes = "*/15 * * * *" CronEveryTenSeconds = "*/10 * * * * * *" CronNightlyAt3 = "0 3 * * *" CronNightlyAt2 = "0 2 * * *" CronNightlyAt4 = "0 4 * * *" CronNightlyAt5 = "0 5 * * *" CronNightlyAt6 = "0 6 * * *" CronNightlyAt7 = "0 7 * * *" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JobCfg ¶
type JobCfg struct {
// contains filtered or unexported fields
}
JobCfg contains data to create a job if not present yet.
type JobInfo ¶
type JobInfo struct {
Name string `json:"name"`
Checksec int `json:"checksec"`
Enabled bool `json:"enabled"`
//owner string
Lockttlsec int `json:"lockttlsec"`
Schedule *cronexpr.Expression
Cronexpr string
LastUpdated time.Time
State []byte
}
JobInfo metadata
type LockRepo ¶
type LockRepo interface {
// Lock - name is the lock Name
// owner is used to indicate the current holder of a lock (eg the hostname)
// interval is the lock TTL
// returns lock object that is a handle for unlocking a lock
Lock(context context.Context, name string, owner string, interval time.Duration) (Lock, error, <-chan error)
}
type Manager ¶
type Manager interface {
Register(name string, schedule string, run func(ctx context.Context, commitFunc func(state []byte) error, state []byte) ([]byte, error))
StartAll()
}
func NewManager ¶
NewManager creates a new job manager. The provided context will be used to execute the individual job functions. In order to cancel all job processing, the provided context can be cancelled.