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.
Sourcepub fn find_after_capture_triggers(
&self,
registry: &TriggerRegistry,
event: &EntityEvent,
) -> Vec<AfterMutationTrigger>
pub fn find_after_capture_triggers( &self, registry: &TriggerRegistry, event: &EntityEvent, ) -> Vec<AfterMutationTrigger>
Find after:capture triggers (#366) matching an externally-captured change.
The change-log reader calls this for captured rows; the match is on entity + event kind, same as after:mutation, but against the separate capture matcher.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for FunctionObserver
impl !UnwindSafe for FunctionObserver
impl Freeze for FunctionObserver
impl Send for FunctionObserver
impl Sync for FunctionObserver
impl Unpin for FunctionObserver
impl UnsafeUnpin 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more