poller

package
v0.0.0-...-d7e1125 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackgroundFunctions

type BackgroundFunctions struct {
	F func(context.Context)
}

type Functions

type Functions struct {
	Get            func(context.Context) (any, error)
	IsDone         func(context.Context, any) bool
	ShouldContinue func(context.Context, any, error) bool
}

func (*Functions) CallGet

func (p *Functions) CallGet(c context.Context) (any, error)

func (*Functions) CallIsDone

func (p *Functions) CallIsDone(c context.Context, a any) bool

func (*Functions) CallShouldContinue

func (p *Functions) CallShouldContinue(c context.Context, a any, e error) bool

type Options

type Options struct {
	StartBotheringAfterTimeout time.Duration
	GetErrorTimeout            time.Duration
	Timeout                    time.Duration
	MainInterval               time.Duration
	BackgroundInterval         time.Duration
}

Options specifies polling options

func NewOptions

func NewOptions() *Options

NewOptions creates new poll options

func (*Options) Ensure

func (o *Options) Ensure() *Options

Ensure ensures poll options do exist

func (*Options) FromConfig

func (o *Options) FromConfig(config *api.OperatorConfig) *Options

FromConfig makes poll options from config

func (*Options) SetGetErrorTimeout

func (o *Options) SetGetErrorTimeout(timeout time.Duration) *Options

SetCreateTimeout sets create timeout

type Poller

type Poller interface {
	Poll() error
	WithOptions(opts *Options) Poller
	WithMain(functions *Functions) Poller
	WithBackground(backgroundFunctions *BackgroundFunctions) Poller
}

func New

func New(ctx context.Context, name string) Poller

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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