readiness

package
v0.13.21 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProcessReadiness

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

ProcessReadiness is the single coordination point for dependency ordering. All process lifecycle events flow through here. All dependency waits resolve here.

func NewProcessReadiness

func NewProcessReadiness() *ProcessReadiness

NewProcessReadiness creates a new ProcessReadiness coordinator.

func (*ProcessReadiness) Cleanup

func (pr *ProcessReadiness) Cleanup(processID string)

Cleanup removes the entry and cancels any running port probe for processID.

func (*ProcessReadiness) MarkExited

func (pr *ProcessReadiness) MarkExited(processID string)

MarkExited signals the process is no longer in the ProcessManager. Unblocks all waiters. Uses RStateExited if not already terminal.

func (*ProcessReadiness) MarkFailed

func (pr *ProcessReadiness) MarkFailed(processID string, err error)

MarkFailed signals the process failed to start or crashed. Unblocks all waiters with the error.

func (*ProcessReadiness) MarkReady

func (pr *ProcessReadiness) MarkReady(processID string)

MarkReady signals the process is serving (URL detected or port bound). Unblocks all waiters.

func (*ProcessReadiness) MarkStarting

func (pr *ProcessReadiness) MarkStarting(processID string)

MarkStarting registers that a process has begun starting. Idempotent if already starting or terminal.

func (*ProcessReadiness) StartPortProbe

func (pr *ProcessReadiness) StartPortProbe(processID string, port int, ctx context.Context)

StartPortProbe launches a goroutine that polls TCP connect on localhost:port. When the port accepts a connection, it calls MarkReady. The probe stops when ctx is cancelled, the port is reached, or Cleanup is called.

func (*ProcessReadiness) Wait

func (pr *ProcessReadiness) Wait(processID string, timeout time.Duration) ReadinessResult

Wait blocks until processID reaches a terminal state or the timeout elapses. Returns immediately if already terminal.

type ReadinessResult

type ReadinessResult struct {
	State ReadinessState
	Err   error // nil for Ready/clean exit, non-nil for Failed
}

ReadinessResult is returned by Wait when a process reaches a terminal state.

type ReadinessState

type ReadinessState uint32

ReadinessState represents the lifecycle state of a process for dependency ordering.

const (
	// RStateUnknown is the initial state before any lifecycle event.
	RStateUnknown ReadinessState = iota
	// RStateStarting means the process has been launched but isn't serving yet.
	RStateStarting
	// RStateReady means the process is serving (URL detected or port bound).
	RStateReady
	// RStateFailed means the process failed to start or crashed.
	RStateFailed
	// RStateExited means the process exited (removed from ProcessManager).
	RStateExited
)

func (ReadinessState) IsTerminal

func (s ReadinessState) IsTerminal() bool

IsTerminal returns true if the state unblocks waiters.

func (ReadinessState) String

func (s ReadinessState) String() string

Jump to

Keyboard shortcuts

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