Skip to main content

Crate alba_engine

Crate alba_engine 

Source
Expand description

Orchestration engine that schedules and runs beams.

alba-engine sits between the model and the machine: it takes the validated alba_core::Project the loader produced, extracts the union of the target beams’ execution subgraphs, and runs it with bounded parallelism through an alba_executors::Executor — which it only ever sees as that trait, so a future docker or plugin executor drops in without this crate changing. See the scheduler module for the scheduling rules themselves.

Everything a caller needs is run: give it a project, Targets, RunOptions, the Executors to dispatch each beam’s declared kind to, a channel to receive RunEvents on, and a cancellation token, and it reports back a RunSummary. watch wraps that same call in a session that re-runs the target whenever the files its inputs declare change; see the session module for the loop’s shape.

Structs§

CacheOptions
Caller-facing cache configuration: where the state lives and whether this run ignores it when reading. force still writes: a forced run rewrites every successful beam’s entry.
Executors
The executors a run can dispatch to, chosen per beam.
NotifyWatcher
RunOptions
How a run is parameterized: everything the caller chose, as opposed to what the Beamfile declares.
RunSummary
What a whole run amounts to: every beam of the target’s subgraph sorted into the bucket it ended in, plus how long the run took.
Targets
What a run schedules: the target beams (each with its subgraph), and where they came from when a git reference chose them.

Enums§

BeamStatus
How a beam ended.
EngineError
Something that stopped Alba from running the beams as asked.
RunEvent
One thing that happened during a run.
Selection
What a run was asked for, before git (if involved) has answered.
SessionCommand
What a session can be told to do, by the TUI or any future driver.
SessionError
Mid-session trouble, handed to the caller’s on_error for rendering.
WatchBatch
One delivery from a file watcher.
WatchExit
Why a session ended. Sessions have no failure exit — mid-session trouble is reported and survived — so this is the complete list.

Traits§

Watcher
A stream of debounced change batches. The indirection exists for the engine’s own tests, which script batches instead of touching a real file system.

Functions§

affected
Every beam affected by what changed since reference, in project order: the beams whose inputs match a changed path or whose Beamfile changed, closed over their dependents. root is the project root git runs from; paths git reports are relative to it.
beamfile_dir
The absolute directory holding beamfile: the project root for the root Beamfile, and its own directory for an imported one.
run
Runs every beam in targets and everything each one needs, and reports what happened.
select
affected narrowed to one run’s targets. Beam is validated here (an unknown beam is the same CoreError a plain run reports), so a caller can rely on select for the exit-2-at-startup rule.
session
Runs selection and keeps re-running it — for a relevant change while watch_enabled, for a SessionCommand from commands — until cancel fires, a Shutdown arrives, or the watcher dies.
watch
Runs selection and keeps re-running it as long as watcher reports relevant changes, until cancel fires or the watcher dies.