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§
- Cache
Options - Caller-facing cache configuration: where the state lives and whether
this run ignores it when reading.
forcestill writes: a forced run rewrites every successful beam’s entry. - Executors
- The executors a run can dispatch to, chosen per beam.
- Notify
Watcher - 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§
- Beam
Status - How a beam ended.
- Engine
Error - 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.
- Session
Command - What a session can be told to do, by the TUI or any future driver.
- Session
Error - Mid-session trouble, handed to the caller’s
on_errorfor rendering. - Watch
Batch - One delivery from a file watcher.
- Watch
Exit - 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 whoseinputsmatch a changed path or whose Beamfile changed, closed over their dependents.rootis 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
targetsand everything each one needs, and reports what happened. - select
affectednarrowed to one run’s targets.Beamis validated here (an unknown beam is the sameCoreErrora plain run reports), so a caller can rely onselectfor the exit-2-at-startup rule.- session
- Runs
selectionand keeps re-running it — for a relevant change whilewatch_enabled, for aSessionCommandfromcommands— untilcancelfires, aShutdownarrives, or the watcher dies. - watch
- Runs
selectionand keeps re-running it as long aswatcherreports relevant changes, untilcancelfires or the watcher dies.