Skip to main content

Executor

Struct Executor 

Source
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: MiddlewareManager

Implementations§

Source§

impl Executor

Source

pub fn new(registry: Registry, config: Config) -> Self

Create a new executor with the given registry and config.

Source

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.

Source

pub fn registry(&self) -> &Registry

Get a reference to the registry.

Source

pub fn middlewares(&self) -> Vec<String>

Get the names of all middlewares in pipeline order.

Source

pub fn set_acl(&mut self, acl: ACL)

Set the ACL for access control.

Source

pub fn set_approval_handler(&mut self, handler: Box<dyn ApprovalHandler>)

Set the approval handler.

Source

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.

Source

pub fn remove(&mut self, name: &str) -> bool

Remove a middleware by name.

Source

pub fn remove_middleware(&mut self, name: &str) -> bool

Remove a middleware by name (legacy alias).

Source

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.

Source

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.

Source

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.

Source

pub fn check_call_depth(&self, ctx: &Context<Value>) -> Result<(), ModuleError>

Check call depth limits before execution.

Source

pub fn check_circular_call( &self, ctx: &Context<Value>, module_id: &str, ) -> Result<(), ModuleError>

Check for circular calls in the call chain.

Source

pub fn from_registry(registry: Registry, config: Config) -> Self

Create an executor from a registry and config.

Source

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.

Source

pub fn use_before( &mut self, middleware: Box<dyn BeforeMiddleware>, ) -> Result<(), ModuleError>

Add a before middleware.

Source

pub fn use_after( &mut self, middleware: Box<dyn AfterMiddleware>, ) -> Result<(), ModuleError>

Add an after middleware.

Trait Implementations§

Source§

impl Debug for Executor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more