Skip to main content

made_core/ports/
executor.rs

1//! [`ExecutorPort`] — opaque execution of a winning proposal.
2//!
3//! After a deliberation produces a winner, the `Orchestrate` use case
4//! optionally hands the proposal off to an executor (e.g. the Underpass
5//! Runtime via gRPC, a local subprocess, a human-in-the-loop queue,
6//! …). MADE does not know what execution means beyond
7//! "adapter runs it and reports an outcome".
8
9use crate::entities::Proposal;
10use crate::error::DomainError;
11use crate::value_objects::{Attributes, ExecutionOutcome};
12use async_trait::async_trait;
13
14#[async_trait]
15pub trait ExecutorPort: Send + Sync {
16    /// Execute the winning proposal. Adapters are free to block or
17    /// stream, as long as the final outcome is returned.
18    async fn execute(
19        &self,
20        winner: &Proposal,
21        options: &Attributes,
22    ) -> Result<ExecutionOutcome, DomainError>;
23}