wait

package
v0.4.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrentOutputLevel = INFO
View Source
var DnsWaiter = &RetryWaiter{
	Check: checkDns,
}
View Source
var HttpWaiter = &RetryWaiter{
	Check: checkHttp,
}
View Source
var TcpWaiter = &RetryWaiter{
	Check: checkTcp,
}

Functions

func Println

func Println(a ...any)

Types

type CompositeMultiWaiter

type CompositeMultiWaiter struct{}

func (CompositeMultiWaiter) Wait

func (c CompositeMultiWaiter) Wait(ctx context.Context, resource string, config Config) error

func (CompositeMultiWaiter) WaitMulti

func (c CompositeMultiWaiter) WaitMulti(resources []string, config Config) error

type Config added in v0.4.0

type Config struct {
	Timeout           time.Duration
	PerAttemptTimeout *time.Duration
	// Limits number of attempts. 0 means unlimited.
	Attempts      uint
	RetryDelay    *time.Duration
	RetryMaxDelay *time.Duration
}

func DefaultConfig added in v0.4.0

func DefaultConfig() Config

type LogWaiterDecorator

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

LogWaiterDecorator wraps a NetWaiter and adds logging around Wait()

func (LogWaiterDecorator) Wait

func (d LogWaiterDecorator) Wait(ctx context.Context, resource string, config Config) error

type NetWaiter

type NetWaiter interface {
	Wait(ctx context.Context, resource string, config Config) error
}

type OutputLevel

type OutputLevel int
const (
	SILENT OutputLevel = iota
	INFO
)

type RetryWaiter added in v0.4.0

type RetryWaiter struct {
	Check func(ctx context.Context, resource string) error
}

RetryWaiter is a generic NetWaiter that retries a check on error until the context deadline expires

func (RetryWaiter) Wait added in v0.4.0

func (w RetryWaiter) Wait(ctx context.Context, resource string, config Config) error

Jump to

Keyboard shortcuts

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