runner

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package runner executes scan runs from a queue with a fixed number of workers and stores their results.

Index

Constants

This section is empty.

Variables

View Source
var ErrQueueFull = errors.New("run queue is full")

ErrQueueFull is returned when too many runs are waiting.

Functions

This section is empty.

Types

type IgnoreFunc

type IgnoreFunc func(ctx context.Context) (*ignore.Rules, error)

IgnoreFunc returns the ignore rules in effect. On an error the rules it still returns are applied; everything else counts.

type Runner

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

Runner queues and executes runs.

func New

func New(st *store.Store, sc *scan.Scanner, workers int, timeout time.Duration, log *slog.Logger) *Runner

New returns a runner. Call Start to process the queue.

func (*Runner) Enqueue

func (r *Runner) Enqueue(ctx context.Context, sc *store.Scan, ref, platforms, trigger string) (*store.Run, error)

Enqueue creates a queued run of ref. sc is the configured scan, or nil for an ad-hoc run.

func (*Runner) QueueLen

func (r *Runner) QueueLen() int

QueueLen returns the number of runs waiting for a worker.

func (*Runner) SetIgnore

func (r *Runner) SetIgnore(fn IgnoreFunc)

SetIgnore sets the source of ignore rules; call it before Start.

func (*Runner) Start

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

Start runs the workers until ctx is canceled. Wait waits for them.

func (*Runner) Wait

func (r *Runner) Wait()

Wait blocks until all workers have stopped.

Jump to

Keyboard shortcuts

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