pub struct FunctionObserver { /* private fields */ }Expand description
Executes functions in response to trigger events.
This observer integrates with the fraiseql-observers action execution pipeline. It receives trigger events, looks up the corresponding function module, selects the appropriate runtime, and executes the function.
Implementations§
Source§impl FunctionObserver
impl FunctionObserver
Sourcepub fn register_runtime<R: FunctionRuntime + 'static>(
&mut self,
runtime_type: RuntimeType,
runtime: R,
)
pub fn register_runtime<R: FunctionRuntime + 'static>( &mut self, runtime_type: RuntimeType, runtime: R, )
Sourcepub async fn invoke<H>(
&self,
module: &FunctionModule,
event: EventPayload,
host: &H,
limits: ResourceLimits,
) -> Result<FunctionResult>where
H: HostContext + ?Sized,
pub async fn invoke<H>(
&self,
module: &FunctionModule,
event: EventPayload,
host: &H,
limits: ResourceLimits,
) -> Result<FunctionResult>where
H: HostContext + ?Sized,
Execute a function module in response to an event.
Dispatches to the appropriate runtime based on the module’s runtime field.
§Errors
Returns Err if:
- No runtime is registered for the module’s runtime type
- The runtime fails to execute the module
Sourcepub fn find_after_mutation_triggers(
&self,
registry: &TriggerRegistry,
event: &EntityEvent,
) -> Vec<AfterMutationTrigger>
pub fn find_after_mutation_triggers( &self, registry: &TriggerRegistry, event: &EntityEvent, ) -> Vec<AfterMutationTrigger>
Find all after:mutation triggers that match a given entity event.
Returns the list of matching AfterMutationTriggers from registry.
Used by after-mutation dispatchers to know which functions to invoke.
This method is allocation-free when no triggers match.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FunctionObserver
impl !RefUnwindSafe for FunctionObserver
impl Send for FunctionObserver
impl Sync for FunctionObserver
impl Unpin for FunctionObserver
impl UnsafeUnpin for FunctionObserver
impl !UnwindSafe for FunctionObserver
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