Documentation ¶
Index ¶
- Constants
- Variables
- func Init(minimumInterval time.Duration)
- func IntervalType(interval Interval) string
- func IsIntervalType(t string) bool
- func ParseScheduleAndPolicies(scheduleString string) ([]RetainInterval, *PolicyTags, error)
- func SamePolicyTags(p1, p2 *PolicyTags) bool
- func ScheduleIntervalSummary(items []Interval, policyTags *PolicyTags) string
- func ScheduleString(items []RetainIntervalSpec, p *PolicyTags) (string, error)
- func ScheduleStringRetainInv(intvs []RetainInterval, p *PolicyTags) (string, error)
- func ScheduleSummary(items []RetainInterval, policyTags *PolicyTags) string
- func SpeedUp()
- func ValidTaskID(t TaskID) bool
- type Interval
- type IntervalSpec
- type PolicyTags
- type RetainInterval
- type RetainIntervalImpl
- type RetainIntervalSpec
- type ScheduleTask
- type Scheduler
- type TaskID
Constants ¶
View Source
const ( DailyType = "daily" MonthlyType = "monthly" WeeklyType = "weekly" PeriodicType = "periodic" MonthlyRetain = 12 WeeklyRetain = 5 DailyRetain = 7 )
View Source
const (
TaskNone = TaskID(0)
)
Variables ¶
View Source
var ParseCLI = map[string]func(string) (RetainIntervalSpec, error){ DailyType: parseDaily, WeeklyType: parseWeekly, MonthlyType: parseMonthly, }
Functions ¶
func IntervalType ¶
func IsIntervalType ¶
func ParseScheduleAndPolicies ¶
func ParseScheduleAndPolicies(scheduleString string) ( []RetainInterval, *PolicyTags, error, )
func SamePolicyTags ¶
func SamePolicyTags(p1, p2 *PolicyTags) bool
func ScheduleIntervalSummary ¶
func ScheduleIntervalSummary(items []Interval, policyTags *PolicyTags) string
func ScheduleString ¶
func ScheduleString(items []RetainIntervalSpec, p *PolicyTags) (string, error)
func ScheduleStringRetainInv ¶
func ScheduleStringRetainInv( intvs []RetainInterval, p *PolicyTags, ) (string, error)
func ScheduleSummary ¶
func ScheduleSummary(items []RetainInterval, policyTags *PolicyTags) string
func ValidTaskID ¶
Types ¶
type Interval ¶
type Interval interface { String() string IntervalType() string Spec() IntervalSpec // contains filtered or unexported methods }
type IntervalSpec ¶
type PolicyTags ¶
type PolicyTags struct { // Names is the list of policy names Names []string }
PolicyTags groups one or more policies together.
func NewPolicyTags ¶
func NewPolicyTags(policies string) (*PolicyTags, error)
func ParsePolicyTags ¶
func ParsePolicyTags(policyTagsStr string) (*PolicyTags, error)
func (*PolicyTags) String ¶
func (p *PolicyTags) String() string
func (*PolicyTags) Summary ¶
func (p *PolicyTags) Summary() string
type RetainInterval ¶
type RetainInterval interface { Interval // RetainNumber is the number of instances to retain RetainNumber() uint32 // RetainIntervalSpec returns RetainIntervalSpec RetainIntervalSpec() RetainIntervalSpec }
RetainInterval is a schedule interval with a number of instances to retain.
func NewRetainInterval ¶
func NewRetainInterval(iv Interval) RetainInterval
func ParseSchedule ¶
func ParseSchedule(schedule string) ([]RetainInterval, error)
func SetupIntvWithDefaults ¶
func SetupIntvWithDefaults(intvs []RetainInterval) []RetainInterval
type RetainIntervalImpl ¶
type RetainIntervalImpl struct {
// contains filtered or unexported fields
}
RetainIntervalImpl implements the RetainInterval interface
func (RetainIntervalImpl) IntervalType ¶
func (p RetainIntervalImpl) IntervalType() string
func (RetainIntervalImpl) RetainIntervalSpec ¶
func (p RetainIntervalImpl) RetainIntervalSpec() RetainIntervalSpec
func (RetainIntervalImpl) RetainNumber ¶
func (p RetainIntervalImpl) RetainNumber() uint32
func (RetainIntervalImpl) Spec ¶
func (p RetainIntervalImpl) Spec() IntervalSpec
func (RetainIntervalImpl) String ¶
func (p RetainIntervalImpl) String() string
type RetainIntervalSpec ¶
type RetainIntervalSpec struct { IntervalSpec `yaml:",inline"` Retain uint32 `yaml:"retain,omitempty"` }
RetainIntervalSpec is the serialized form of retain interval
func ParsePeriodic ¶
func ParsePeriodic(input string) (RetainIntervalSpec, error)
type ScheduleTask ¶
type ScheduleTask func(Interval)
type Scheduler ¶
type Scheduler interface { // Schedule given task at given interval. // Returns associated task id if scheduled successfully, // or a non-nil error in case of error. Schedule(task ScheduleTask, interval Interval, runAt time.Time, onlyOnce bool) (TaskID, error) // Cancel given task. Cancel(taskID TaskID) error // Restart scheduling. Start() // Stop scheduling. Stop() }
Click to show internal directories.
Click to hide internal directories.