checkworker

package
v0.0.0-...-9709152 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: AGPL-3.0 Imports: 44 Imported by: 0

Documentation

Overview

Package checkworker implements distributed check job execution.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownCheckType   = errors.New("unknown check type")
	ErrCheckerNotFound    = errors.New("checker not found for type")
	ErrFailedToParseConf  = errors.New("failed to parse config")
	ErrFailedToFetchCheck = errors.New("failed to fetch check from database")
	ErrNoCheckType        = errors.New("check job has no type set")

	// ErrCheckerPanic wraps a recovered panic from inside a checker's
	// Execute call (spec 2026-07-05-05 D2). The runner survives; the panic
	// is converted into a StatusError result instead of crashing the
	// process.
	ErrCheckerPanic = errors.New("checker panicked")

	// ErrCheckerAbandoned marks a checker execution the watchdog gave up
	// on because the checker never observed its context deadline within
	// execTimeout + abandonGrace (spec 2026-07-05-05 D1).
	ErrCheckerAbandoned = errors.New("check execution abandoned: checker did not honor its context")
)

Errors returned by the check runner.

Functions

This section is empty.

Types

type CheckWorker

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

CheckWorker executes check jobs from the queue.

func NewAgentCheckWorker

func NewAgentCheckWorker(cfg *config.Config, workerBackend backend.WorkerBackend) *CheckWorker

NewAgentCheckWorker creates a check runner for agent mode: no database, no services registry — everything flows through the given (remote) backend. Self-stats and the entitlements gate are in-process concerns and are skipped; the server enforces per-org rate limits on the agent claim path.

func NewCheckWorker

func NewCheckWorker(
	dbService db.Service,
	cfg *config.Config,
	svc *services.Registry,
	checkJobSvc checkjobsvc.Service,
) *CheckWorker

NewCheckWorker creates a new check runner wired to the in-process DirectBackend (the production server path).

func (*CheckWorker) Run

func (r *CheckWorker) Run(ctx context.Context) error

Run starts the runner loop (blocking).

func (*CheckWorker) SetFaultLatch

func (r *CheckWorker) SetFaultLatch(latch *dbfault.Latch)

SetFaultLatch installs the process-wide structural-fault latch. Set by the server before Run; a worker without one never terminates the process.

Directories

Path Synopsis
Package backend provides the WorkerBackend interface that abstracts how the check worker loop (internal/checkworker) talks to the master: DirectBackend calls the database and services in-process (the production server path), WSBackend (agent mode) speaks the WebSocket agent protocol to a remote server.
Package backend provides the WorkerBackend interface that abstracts how the check worker loop (internal/checkworker) talks to the master: DirectBackend calls the database and services in-process (the production server path), WSBackend (agent mode) speaks the WebSocket agent protocol to a remote server.
Package checkjobsvc provides check job queue operations for the distributed check runner system.
Package checkjobsvc provides check job queue operations for the distributed check runner system.
Package egressreport turns this process's live egress self-probe into the shape the worker row stores, for the in-process worker and the deported agent alike (spec 2026-08-15-11).
Package egressreport turns this process's live egress self-probe into the shape the worker row stores, for the in-process worker and the deported agent alike (spec 2026-08-15-11).
Package scheduling holds the pure, side-effect-free math for cost-aware, plan-weighted check scheduling (spec 2026-06-30-09, cost-only offset per spec 2026-07-01-02).
Package scheduling holds the pure, side-effect-free math for cost-aware, plan-weighted check scheduling (spec 2026-06-30-09, cost-only offset per spec 2026-07-01-02).

Jump to

Keyboard shortcuts

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