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) -> Executor
pub fn new(registry: Registry, config: Config) -> Executor
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>>,
) -> Executor
pub fn with_options( registry: Registry, config: Config, middlewares: Option<Vec<Box<dyn Middleware>>>, acl: Option<ACL>, approval_handler: Option<Box<dyn ApprovalHandler>>, ) -> Executor
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>)
pub fn use_middleware(&mut self, middleware: Box<dyn Middleware>)
Add a middleware to the pipeline.
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<(), ModuleError>
pub async fn validate( &self, module_id: &str, inputs: &Value, ) -> Result<(), ModuleError>
Validate module inputs without executing (steps 1-6 only).
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) -> Executor
pub fn from_registry(registry: Registry, config: Config) -> Executor
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>)
pub fn use_before(&mut self, middleware: Box<dyn BeforeMiddleware>)
Add a before middleware.
Sourcepub fn use_after(&mut self, middleware: Box<dyn AfterMiddleware>)
pub fn use_after(&mut self, middleware: Box<dyn AfterMiddleware>)
Add an after middleware.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Executor
impl !RefUnwindSafe for Executor
impl Send for Executor
impl Sync for Executor
impl Unpin for Executor
impl UnsafeUnpin for Executor
impl !UnwindSafe for Executor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more