orchestrator

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadDispatch = errors.New("ctx, linter and regexp must be provided")

ErrBadDispatch is returned when a dispatcher is created with bad parameters

Functions

This section is empty.

Types

type Job

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

Job is a single job to be run by the orchestrator it carries its dispatcher's context across the queue, like an http.Request, for the producer span and cancellation

type JobOrchestrator

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

JobOrchestrator is responsible for dispatching jobs to dispatchers

func New

func New(files []string, reporter linter.Reporter, locking, failFast bool) *JobOrchestrator

New creates a new JobOrchestrator locking decides if we should have an exclusive lock per file due to potential writes

func (*JobOrchestrator) CreateDispatcher

func (d *JobOrchestrator) CreateDispatcher(ctx context.Context, l linter.Linter, reg *regexp.Regexp, groupBy string) error

CreateDispatcher submits jobQ to the dispatchers, ctx should be the one returned by Start so it stops when the run is aborted. If groupBy is non-empty, matched files are grouped by nearest ancestor directory containing the named marker file (e.g. "go.mod"), and the linter runs once per group. Otherwise a batched linter.BatchLinter runs once per chunk of the matched files, see batchChunks.

func (*JobOrchestrator) Start

func (d *JobOrchestrator) Start(ctx context.Context) (context.Context, func() error)

Start starts the orchestrator, like errgroup.WithContext the returned context is cancelled when the run is aborted and is the one to pass to CreateDispatcher. The returned func waits for the run to finish.

Jump to

Keyboard shortcuts

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