sentinel

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_TIMEOUT  = 0 //no timeout
	DEFAULT_INTERVAL = 100 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Done

type Done func() bool

type Sentinel

type Sentinel struct {
	StatusFn   func() (doneFn Done, statusResp any, err error)
	OnCancelFn func() (onCancelFnResp any, err error)
	OnDoneFn   func(statusResp any) (onDoneFnResp any, err error)
	// contains filtered or unexported fields
}

func (Sentinel) Watch

func (s Sentinel) Watch(ctx context.Context, interval, timeout time.Duration) (WatchStatus, any, error)

Wait takes care of checking the status of something on a given interval, up to a timeout. The StatusFn check will continue until given Done function returns true or statusFn returns an error. Context cancellation is supported and in that case it will return WaitCanceled status.

type WatchStatus

type WatchStatus int
const (
	WatchSuccess WatchStatus = iota
	WatchErr
	WatchExecuting
	WatchTimeout
	WatchCanceled
)

func (WatchStatus) String

func (s WatchStatus) String() string

Jump to

Keyboard shortcuts

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