steps

package
v0.0.0-...-37f2402 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWantRefresh = errors.New("want refresh")

Functions

func FriendlyName

func FriendlyName(f interface{}) string

FriendlyName returns a "friendly" stringified name of the given func.

func Run

func Run(ctx context.Context, log *logrus.Entry, pollInterval time.Duration, steps []Step, now func() time.Time) (map[string]int64, error)

Run executes the provided steps in order until one fails or all steps are completed. Errors from failed steps are returned directly. time cost for each step run will be recorded for metrics usage

Types

type Step

type Step interface {
	String() string
	// contains filtered or unexported methods
}

Step is the interface for steps that Runner can execute.

func Action

func Action(f actionFunction) Step

Action returns a Step which will execute the action function `f`. Errors from `f` are returned directly.

func AuthorizationRetryingAction

func AuthorizationRetryingAction(r refreshable.Authorizer, action actionFunction) Step

AuthorizationRefreshingAction returns a wrapper Step which will refresh `authorizer` if the step returns an Azure AuthenticationError and rerun it. The step will be retried until `retryTimeout` is hit. Any other error will be returned directly.

func Condition

func Condition(f conditionFunction, timeout time.Duration, fail bool) Step

Condition returns a Step suitable for checking whether subsequent Steps can be executed.

The Condition will execute f repeatedly (every Runner.pollInterval), timing out with a failure when more time than the provided timeout has elapsed without f returning (true, nil). Errors from `f` are returned directly. If fail is set to false - it will not fail after timeout.

Jump to

Keyboard shortcuts

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