api

package
v0.20.4-rc2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PerformTask

func PerformTask(userTask func() error, opts *TriggerOptions) error

PerformTask invokes the function using the given trigger options to decide when to invoke the task

Types

type TriggerCallbackFunc

type TriggerCallbackFunc func() (bool, error)

TriggerCallbackFunc is a callback function that are used by scheduler APIs to decide when to trigger/perform actions. the function should return true, when it is the right time to perform the respective action

type TriggerOptions

type TriggerOptions struct {
	// TriggerCb is the callback function to invoke to check trigger condition
	TriggerCb TriggerCallbackFunc
	// TriggerCheckInterval is the interval at which to check the trigger conditions
	TriggerCheckInterval time.Duration
	// TriggerCheckTimeout is the duration at which the trigger checks should timeout. If the trigger
	TriggerCheckTimeout time.Duration
	// BlockForTrigger if set true will block the call until the TriggerCb either passes or times out
	BlockForTrigger bool
}

TriggerOptions are common options used to check if any action is okay to be triggered/performed

Jump to

Keyboard shortcuts

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