runner

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package runner periodically executes a Probe and pushes the result into a State, invoking Reporters on transitions. Decouples probe execution from transport — transports read cached State instead of running checks per-request (matters for gRPC Watch, expensive checks, or bursty traffic).

Index

Constants

View Source
const (
	DefaultInterval = 5 * time.Second
	DefaultTimeout  = 2 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Runner)

Option configures a Runner.

func RunImmediately

func RunImmediately() Option

RunImmediately performs an initial check before the first tick. Default: false (state stays StatusUnknown until first tick).

func WithInterval

func WithInterval(d time.Duration) Option

func WithName

func WithName(n string) Option

func WithReporter

func WithReporter(rep reporter.Reporter) Option

func WithTimeout

func WithTimeout(d time.Duration) Option

type Runner

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

Runner polls a probe.Probe and updates a state.State.

func New

func New(p probe.Probe, s *state.State, opts ...Option) *Runner

New constructs a Runner. The provided state is updated on every tick.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context)

Run blocks until ctx is canceled, periodically checking the probe.

func (*Runner) Start

func (r *Runner) Start(ctx context.Context)

Start launches Run in a goroutine and returns immediately.

Jump to

Keyboard shortcuts

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