Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ScheduledExecutor ¶
type ScheduledExecutor struct { TimeKeeper timekeeper.TimeKeeper // contains filtered or unexported fields }
ScheduledExecutor is an abstraction for running things on a schedule
func NewScheduledExecutor ¶
func NewScheduledExecutor(scheduleRate time.Duration) *ScheduledExecutor
NewScheduledExecutor returns a new ScheduledExecutor that will file
func (*ScheduledExecutor) Close ¶
func (se *ScheduledExecutor) Close() error
Close stops the ScheduledExecutor
func (*ScheduledExecutor) SetScheduleRate ¶
func (se *ScheduledExecutor) SetScheduleRate(scheduleRate time.Duration)
SetScheduleRate sets the new rate at which runs should run for this ScheduledExecutor
func (*ScheduledExecutor) Start ¶
func (se *ScheduledExecutor) Start(iterationFunc func() error) error
Start starts the execution of a func on the schedule of the ScheduledExecutor. This method blocks until the ScheduledExecutor's Close method is called or iterationFunc returns an error
func (*ScheduledExecutor) StartWithMsgChan ¶
func (se *ScheduledExecutor) StartWithMsgChan(iterationFunc func() error, msgChan chan time.Duration) error
StartWithMsgChan starts the execution of a func on the schedule of the ScheduledExecutor. This method blocks until the ScheduledExecutor's Close method is called or iterationFunc returns an error. msgChan receives the duration of how long the ScheduledExecutor will sleep before the start of every iteration.