pub trait Action: Send + Sync {
// Required methods
fn id(&self) -> ActionId;
fn deps(&self) -> Vec<ActionId>;
fn input_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
) -> Pin<Box<dyn Future<Output = Result<Sha256, BuildError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
) -> Pin<Box<dyn Future<Output = Result<BuildOutput, BuildError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn is_coordinator(&self) -> bool { ... }
fn output_present<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Represents an executable action within the repolith graph.
Actions are the fundamental units of work. They declare their dependencies, compute their input state, and execute their logic.
Note: Long-running execute implementations should periodically poll
ctx.cancel.is_cancelled() to support graceful termination.
Required Methods§
Sourcefn input_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
) -> Pin<Box<dyn Future<Output = Result<Sha256, BuildError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn input_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
) -> Pin<Box<dyn Future<Output = Result<Sha256, BuildError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Computes the hash representing the input state of this action. This is used for caching and determining if the action needs to run.
Sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
) -> Pin<Box<dyn Future<Output = Result<BuildOutput, BuildError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
) -> Pin<Box<dyn Future<Output = Result<BuildOutput, BuildError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Executes the action’s core logic.
Provided Methods§
Sourcefn is_coordinator(&self) -> bool
fn is_coordinator(&self) -> bool
true for actions that only coordinate other actions (federation’s
RepolithSync) rather than doing bounded work themselves.
The orchestrator does not charge a concurrency permit for
coordinators: the child actions they spawn acquire from the same
shared semaphore, so charging the coordinator too would deadlock at
--jobs 1 (the coordinator would hold the only permit while its
children wait for it).
Sourcefn output_present<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn output_present<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Whether the artifact this action produces is still present.
A cached Success only means “these inputs were built somewhere,
once” — not that the result is still on this machine. Without
this probe the planner trusts the cache blindly and reports
up to date when the binary was deleted, or when the cache entry
was written by a different machine sharing a backend (see the
Neo4j backend). Actions that leave a persistent artifact should
override this; the default true suits actions with nothing to
check (coordinators, pure side effects).
Implementations must be cheap — this runs for every action on
every plan. A stat or a single subprocess, nothing more. On any
doubt return true: a false negative causes a needless rebuild,
while a false positive resurrects the silent-staleness bug.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".