pub struct LocalEffectExecutor<S: StateStore + ?Sized, O: Orchestrator + ?Sized> {
pub state: Arc<S>,
pub orch: Arc<O>,
pub unknown_policy: UnknownEffectPolicy,
/* private fields */
}Expand description
Local executor that applies memory effects to a StateStore and
translates orchestration effects into Orchestrator calls.
Semantics:
- WriteMemory/DeleteMemory: executed directly against the supplied state.
- Delegate: immediate dispatch via
Orchestrator::dispatch. - Handoff: immediate dispatch via
Orchestrator::dispatchwith a metadata flag set to mark semantic handoff. The flag is{ "handoff": true }on the dispatchedOperatorInput’smetadatafield. - Signal: sent via
Orchestrator::signal.
Unknown/custom effects: ignored by default (warn logged). Configurable via
unknown_policy.
Fields§
§state: Arc<S>State backend used for memory effects.
orch: Arc<O>Orchestrator used for delegation, handoff, and signals.
unknown_policy: UnknownEffectPolicyUnknown effect handling policy.
Implementations§
Source§impl<S: StateStore + ?Sized, O: Orchestrator + ?Sized> LocalEffectExecutor<S, O>
impl<S: StateStore + ?Sized, O: Orchestrator + ?Sized> LocalEffectExecutor<S, O>
Sourcepub fn new(state: Arc<S>, orch: Arc<O>) -> Self
pub fn new(state: Arc<S>, orch: Arc<O>) -> Self
Create a new local effect executor with default policy IgnoreAndWarn.
Sourcepub fn with_unknown_policy(self, policy: UnknownEffectPolicy) -> Self
pub fn with_unknown_policy(self, policy: UnknownEffectPolicy) -> Self
Override the unknown/custom effect handling policy.
Sourcepub fn with_store_middleware(self, stack: StoreStack) -> Self
pub fn with_store_middleware(self, stack: StoreStack) -> Self
Attach a store middleware stack. Each WriteMemory effect is routed through
the stack before reaching the state backend.
A guard middleware can skip the write by not calling next and returning Ok(()).
A transformer middleware can substitute the value before calling next.
Trait Implementations§
Source§impl<S, O> EffectExecutor for LocalEffectExecutor<S, O>
impl<S, O> EffectExecutor for LocalEffectExecutor<S, O>
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
effects: &'life1 [Effect],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
effects: &'life1 [Effect],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute a list of effects in order. Implementations must preserve
the provided order and short-circuit on the first error.
Auto Trait Implementations§
impl<S, O> Freeze for LocalEffectExecutor<S, O>
impl<S, O> !RefUnwindSafe for LocalEffectExecutor<S, O>
impl<S, O> Send for LocalEffectExecutor<S, O>
impl<S, O> Sync for LocalEffectExecutor<S, O>
impl<S, O> Unpin for LocalEffectExecutor<S, O>
impl<S, O> UnsafeUnpin for LocalEffectExecutor<S, O>
impl<S, O> !UnwindSafe for LocalEffectExecutor<S, O>
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