pub struct TriggerExecutionService<T: TriggerRepositoryTrait> { /* private fields */ }
Expand description
Service for executing triggers with notifications
Coordinates trigger lookup, variable substitution, and notification delivery across different notification channels
Implementations§
Source§impl<T: TriggerRepositoryTrait> TriggerExecutionService<T>
impl<T: TriggerRepositoryTrait> TriggerExecutionService<T>
Sourcepub fn new(
trigger_service: TriggerService<T>,
notification_service: NotificationService,
) -> Self
pub fn new( trigger_service: TriggerService<T>, notification_service: NotificationService, ) -> Self
Trait Implementations§
Source§impl<T: TriggerRepositoryTrait + Send + Sync> TriggerExecutionServiceTrait for TriggerExecutionService<T>
impl<T: TriggerRepositoryTrait + Send + Sync> TriggerExecutionServiceTrait for TriggerExecutionService<T>
Source§fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
trigger_slugs: &'life1 [String],
variables: HashMap<String, String>,
monitor_match: &'life2 MonitorMatch,
trigger_scripts: &'life3 HashMap<String, (ScriptLanguage, String)>,
) -> Pin<Box<dyn Future<Output = Result<(), TriggerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
trigger_slugs: &'life1 [String],
variables: HashMap<String, String>,
monitor_match: &'life2 MonitorMatch,
trigger_scripts: &'life3 HashMap<String, (ScriptLanguage, String)>,
) -> Pin<Box<dyn Future<Output = Result<(), TriggerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Executes multiple triggers with variable substitution
§Arguments
trigger_slugs
- List of trigger identifiers to executevariables
- Variables to substitute in trigger templates
§Returns
Result<(), TriggerError>
- Success or error
§Errors
- Returns
TriggerError::NotFound
if a trigger cannot be found - Returns
TriggerError::ExecutionError
if notification delivery fails
Source§fn load_scripts<'life0, 'life1, 'async_trait>(
&'life0 self,
monitors: &'life1 [Monitor],
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, (ScriptLanguage, String)>, TriggerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_scripts<'life0, 'life1, 'async_trait>(
&'life0 self,
monitors: &'life1 [Monitor],
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, (ScriptLanguage, String)>, TriggerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Loads trigger condition scripts for monitors
§Arguments
monitors
- List of monitors containing trigger conditions
§Returns
Result<HashMap<String, (ScriptLanguage, String)>, TriggerError>
- Map of monitor names and script path to their script language and content
§Errors
- Returns
TriggerError::ConfigurationError
if script files cannot be read
Auto Trait Implementations§
impl<T> Freeze for TriggerExecutionService<T>where
T: Freeze,
impl<T> RefUnwindSafe for TriggerExecutionService<T>where
T: RefUnwindSafe,
impl<T> Send for TriggerExecutionService<T>where
T: Send,
impl<T> Sync for TriggerExecutionService<T>where
T: Sync,
impl<T> Unpin for TriggerExecutionService<T>where
T: Unpin,
impl<T> UnwindSafe for TriggerExecutionService<T>where
T: UnwindSafe,
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
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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