schedexec

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

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.

Jump to

Keyboard shortcuts

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