async

package
v1.0.0-beta.24 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitSync

func WaitSync(config *WaitSyncConfig) (terminalValue interface{}, err error)

WaitSync waits and returns when a given stop condition is true or if an error occurs.

Types

type IntervalStrategy

type IntervalStrategy func() <-chan time.Time

func FibonacciIntervalStrategy

func FibonacciIntervalStrategy(base time.Duration, factor float32) IntervalStrategy

FibonacciIntervalStrategy defines an interval duration who follow the Fibonacci sequence.

func LinearIntervalStrategy

func LinearIntervalStrategy(interval time.Duration) IntervalStrategy

LinearIntervalStrategy defines a linear interval duration.

type WaitSyncConfig

type WaitSyncConfig struct {
	// This method will be called from another goroutine.
	Get              func() (value interface{}, isTerminal bool, err error)
	IntervalStrategy IntervalStrategy
	Timeout          time.Duration
}

WaitSyncConfig defines the waiting options.

Jump to

Keyboard shortcuts

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