readiness

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker interface {
	Check(ctx context.Context, id fmt.Stringer, check func(context.Context) (bool, error)) (ReadyStatus, error)
}

Checker checks readiness and returns a Status. It may be a single probe, watch or a polling wait, depending on implementation.

type Poller

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

Poller repeatedly calls the underlying Checker at the configured period until Ready, Error, or context cancellation/timeout. prober := readiness.NewProber(1 * time.Minute) // single-check timeout poller := readiness.NewPoller(5*time.Second, prober) // polling loop

func NewPoller

func NewPoller(period time.Duration, checker Checker) *Poller

func (*Poller) Check

func (p *Poller) Check(ctx context.Context, id fmt.Stringer, waitFunc func(context.Context) (bool, error)) (ReadyStatus, error)

type Prober

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

Prober performs a single readiness check and returns Ready/InProgress/Error. Each check is bounded by the timeout configured in the constructor.

Usage:

status, err := readiness.NewProber(time.Minute).Check(ctx, id, fn)

func NewProber

func NewProber(proberTimeout time.Duration) *Prober

func (*Prober) Check

func (p *Prober) Check(ctx context.Context, id fmt.Stringer, checkFunc func(context.Context) (bool, error)) (ReadyStatus, error)

type ReadyStatus

type ReadyStatus int
const (
	InProgress ReadyStatus = iota
	Ready
	Error
)

func (ReadyStatus) AsFuncResult

func (r ReadyStatus) AsFuncResult(err error) (bool, error)

func (ReadyStatus) Failed

func (r ReadyStatus) Failed() bool

func (ReadyStatus) IsNotReady

func (r ReadyStatus) IsNotReady() bool

func (ReadyStatus) IsReady

func (r ReadyStatus) IsReady() bool

type Ref

type Ref struct {
	Namespace string
	Name      string
}

func (Ref) String

func (r Ref) String() string

Jump to

Keyboard shortcuts

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