pub struct Executor {
pub registry: Registry,
pub config: Config,
pub acl: Option<ACL>,
pub approval_handler: Option<Box<dyn ApprovalHandler>>,
pub middleware_manager: MiddlewareManager,
}Expand description
Responsible for executing modules with middleware, ACL, and context management.
Fields§
§registry: Registry§config: Config§acl: Option<ACL>§approval_handler: Option<Box<dyn ApprovalHandler>>§middleware_manager: MiddlewareManagerImplementations§
Source§impl Executor
impl Executor
Sourcepub fn new(registry: Registry, config: Config) -> Self
pub fn new(registry: Registry, config: Config) -> Self
Create a new executor with the given registry and config.
Sourcepub fn with_options(
registry: Registry,
config: Config,
middlewares: Option<Vec<Box<dyn Middleware>>>,
acl: Option<ACL>,
approval_handler: Option<Box<dyn ApprovalHandler>>,
) -> Self
pub fn with_options( registry: Registry, config: Config, middlewares: Option<Vec<Box<dyn Middleware>>>, acl: Option<ACL>, approval_handler: Option<Box<dyn ApprovalHandler>>, ) -> Self
Create a new executor with all optional parameters.
Sourcepub fn middlewares(&self) -> Vec<String>
pub fn middlewares(&self) -> Vec<String>
Get the names of all middlewares in pipeline order.
Sourcepub fn set_approval_handler(&mut self, handler: Box<dyn ApprovalHandler>)
pub fn set_approval_handler(&mut self, handler: Box<dyn ApprovalHandler>)
Set the approval handler.
Sourcepub fn use_middleware(
&mut self,
middleware: Box<dyn Middleware>,
) -> Result<(), ModuleError>
pub fn use_middleware( &mut self, middleware: Box<dyn Middleware>, ) -> Result<(), ModuleError>
Add a middleware to the pipeline.
Returns an error if the middleware’s priority exceeds the allowed range.
Sourcepub fn remove_middleware(&mut self, name: &str) -> bool
pub fn remove_middleware(&mut self, name: &str) -> bool
Remove a middleware by name (legacy alias).
Sourcepub async fn call(
&self,
module_id: &str,
inputs: Value,
ctx: Option<&Context<Value>>,
_version_hint: Option<&str>,
) -> Result<Value, ModuleError>
pub async fn call( &self, module_id: &str, inputs: Value, ctx: Option<&Context<Value>>, _version_hint: Option<&str>, ) -> Result<Value, ModuleError>
Execute (call) a module by ID with the given inputs and context.
Sourcepub async fn call_async(
&self,
module_id: &str,
inputs: Value,
ctx: Option<&Context<Value>>,
version_hint: Option<&str>,
) -> Result<Value, ModuleError>
pub async fn call_async( &self, module_id: &str, inputs: Value, ctx: Option<&Context<Value>>, version_hint: Option<&str>, ) -> Result<Value, ModuleError>
Alias for call() — provided for spec compatibility.
Sourcepub async fn validate(
&self,
module_id: &str,
inputs: &Value,
) -> Result<ValidationResult, ModuleError>
pub async fn validate( &self, module_id: &str, inputs: &Value, ) -> Result<ValidationResult, ModuleError>
Validate module inputs without executing (steps 1-7).
Returns a ValidationResult containing any preflight warnings.
Preflight failures are advisory and never block validation.
Sourcepub fn check_call_depth(&self, ctx: &Context<Value>) -> Result<(), ModuleError>
pub fn check_call_depth(&self, ctx: &Context<Value>) -> Result<(), ModuleError>
Check call depth limits before execution.
Sourcepub fn check_circular_call(
&self,
ctx: &Context<Value>,
module_id: &str,
) -> Result<(), ModuleError>
pub fn check_circular_call( &self, ctx: &Context<Value>, module_id: &str, ) -> Result<(), ModuleError>
Check for circular calls in the call chain.
Sourcepub fn from_registry(registry: Registry, config: Config) -> Self
pub fn from_registry(registry: Registry, config: Config) -> Self
Create an executor from a registry and config.
Sourcepub async fn stream(
&self,
module_id: &str,
inputs: Value,
ctx: Option<&Context<Value>>,
version_hint: Option<&str>,
) -> Result<Vec<Value>, ModuleError>
pub async fn stream( &self, module_id: &str, inputs: Value, ctx: Option<&Context<Value>>, version_hint: Option<&str>, ) -> Result<Vec<Value>, ModuleError>
Stream execution of a module.
Sourcepub fn use_before(
&mut self,
middleware: Box<dyn BeforeMiddleware>,
) -> Result<(), ModuleError>
pub fn use_before( &mut self, middleware: Box<dyn BeforeMiddleware>, ) -> Result<(), ModuleError>
Add a before middleware.
Sourcepub fn use_after(
&mut self,
middleware: Box<dyn AfterMiddleware>,
) -> Result<(), ModuleError>
pub fn use_after( &mut self, middleware: Box<dyn AfterMiddleware>, ) -> Result<(), ModuleError>
Add an after middleware.