Documentation
¶
Overview ¶
Package dispatch implements the daemon's remote-compile path: read the cached JWT written by `hpcc auth login`, 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/auth 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, sourceMode enum.SourceMode) (*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.
sourceMode is taken from the top-level config (it drives both the dispatch wire format AND the local cache key — see enum.SourceMode); it's threaded in here rather than read off RemoteConfig because the field lives on the parent Config now.
func (*Dispatcher) Close ¶
func (d *Dispatcher) Close() error
Close shuts down all gRPC connections (scheduler + worker pool).
func (*Dispatcher) Dispatch ¶
func (d *Dispatcher) Dispatch(ctx context.Context, c compiler.Compiler, inv *compiler.Invocation) (*compiler.InvocationResult, error)
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.
func (*Dispatcher) ImageDigest ¶
func (d *Dispatcher) ImageDigest() string
ImageDigest returns the OCI image digest the dispatcher tags every Compile RPC with. Exposed for the daemon's `hpcc explain` record so the daemon can report image-pin changes as a discrete cache-miss reason without rerunning the dispatcher.
func (*Dispatcher) SourceMode ¶
func (d *Dispatcher) SourceMode() enum.SourceMode
SourceMode reports the dispatcher's configured source-staging strategy (preprocessed or CAS). The daemon reads this to widen the dispatch gate for invocations that PREPROCESSED can't safely handle (e.g. GAS .S with .incbin — see Cacheable's comments).