raterun

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(fn RunFunction, rates []Rate) (*rrInstance, error)

New creates a new runner which varies in time according to given rates

Types

type Rate

type Rate struct {
	Start time.Duration // when to start this rate
	Rate  time.Duration // run in amount of Duration
}

type RatedRunnerStage

type RatedRunnerStage struct {
	// contains filtered or unexported fields
}

type RunFunction

type RunFunction func(rate time.Duration, t time.Time)

RunFunction function to be executed at specified rate

type Runner

type Runner interface {
	// Terminate cancels scheduling for the next run
	Terminate()
	// RestartRate resets function calling back to first defined rate
	RestartRate()
	// run starts running the function at rates provided to the constructor
	Run()
}

Jump to

Keyboard shortcuts

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