dispatch

package
v0.0.0-...-be07f6e Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package dispatch implements the daemon's remote-compile path: get a JWT from the configured IdP via OAuth password grant, authenticate against the scheduler, route each compile to a worker, and dial the worker directly to invoke Compile. Lives in its own package so the daemon doesn't grow a tangle of grpc/TLS/oauth wiring inline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

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

Dispatcher is the daemon-side handle to the scheduler+worker mesh. One per daemon process; goroutine-safe. Dial happens once at New; session tokens are refreshed on demand.

func New

func New(cfg config.RemoteConfig) (*Dispatcher, error)

New dials the scheduler and returns a ready Dispatcher. The scheduler connection is lazy at the gRPC layer (no actual TCP until first RPC), so a misconfigured scheduler URL surfaces on the first compile, not at daemon startup.

func (*Dispatcher) Close

func (d *Dispatcher) Close() error

Close shuts down all gRPC connections (scheduler + worker pool).

func (*Dispatcher) Dispatch

Dispatch runs a single compile remotely: preprocess locally, route via scheduler, send to the worker. The returned InvocationResult is shaped exactly like a local compile so the caller can plug it into the same cache/write/return path.

On any remote-side error (auth, route, dial, RPC) the session token is cleared (next call re-authenticates) and the error is returned — the caller is responsible for falling back to local execution.

Jump to

Keyboard shortcuts

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