pub struct MonitorRepository<N: NetworkRepositoryTrait + Send + 'static, T: TriggerRepositoryTrait + Send + 'static> {
pub monitors: HashMap<String, Monitor>,
/* private fields */
}
Expand description
Repository for storing and retrieving monitor configurations
Fields§
§monitors: HashMap<String, Monitor>
Map of monitor names to their configurations
Implementations§
Source§impl<N: NetworkRepositoryTrait + Send + Sync + 'static, T: TriggerRepositoryTrait + Send + Sync + 'static> MonitorRepository<N, T>
impl<N: NetworkRepositoryTrait + Send + Sync + 'static, T: TriggerRepositoryTrait + Send + Sync + 'static> MonitorRepository<N, T>
Sourcepub async fn new(
path: Option<&Path>,
network_service: Option<NetworkService<N>>,
trigger_service: Option<TriggerService<T>>,
) -> Result<Self, RepositoryError>
pub async fn new( path: Option<&Path>, network_service: Option<NetworkService<N>>, trigger_service: Option<TriggerService<T>>, ) -> Result<Self, RepositoryError>
Create a new monitor repository from the given path
Loads all monitor configurations from JSON files in the specified directory (or default config directory if None is provided).
Sourcepub fn new_with_monitors(monitors: HashMap<String, Monitor>) -> Self
pub fn new_with_monitors(monitors: HashMap<String, Monitor>) -> Self
Create a new monitor repository from a list of monitors
Trait Implementations§
Source§impl<N: Clone + NetworkRepositoryTrait + Send + 'static, T: Clone + TriggerRepositoryTrait + Send + 'static> Clone for MonitorRepository<N, T>
impl<N: Clone + NetworkRepositoryTrait + Send + 'static, T: Clone + TriggerRepositoryTrait + Send + 'static> Clone for MonitorRepository<N, T>
Source§fn clone(&self) -> MonitorRepository<N, T>
fn clone(&self) -> MonitorRepository<N, T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<N: NetworkRepositoryTrait + Send + Sync + 'static, T: TriggerRepositoryTrait + Send + Sync + 'static> MonitorRepositoryTrait<N, T> for MonitorRepository<N, T>
impl<N: NetworkRepositoryTrait + Send + Sync + 'static, T: TriggerRepositoryTrait + Send + Sync + 'static> MonitorRepositoryTrait<N, T> for MonitorRepository<N, T>
Source§fn load_from_path<'life0, 'life1, 'async_trait>(
&'life0 self,
path: Option<&'life1 Path>,
network_service: Option<NetworkService<N>>,
trigger_service: Option<TriggerService<T>>,
) -> Pin<Box<dyn Future<Output = Result<Monitor, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_from_path<'life0, 'life1, 'async_trait>(
&'life0 self,
path: Option<&'life1 Path>,
network_service: Option<NetworkService<N>>,
trigger_service: Option<TriggerService<T>>,
) -> Pin<Box<dyn Future<Output = Result<Monitor, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load a monitor from a specific path
Loads a monitor configuration from a specific path and validates all network and trigger references.
Source§fn new<'life0, 'async_trait>(
path: Option<&'life0 Path>,
network_service: Option<NetworkService<N>>,
trigger_service: Option<TriggerService<T>>,
) -> Pin<Box<dyn Future<Output = Result<Self, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn new<'life0, 'async_trait>(
path: Option<&'life0 Path>,
network_service: Option<NetworkService<N>>,
trigger_service: Option<TriggerService<T>>,
) -> Pin<Box<dyn Future<Output = Result<Self, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a new monitor repository from the given path
Source§fn load_all<'life0, 'async_trait>(
path: Option<&'life0 Path>,
network_service: Option<NetworkService<N>>,
trigger_service: Option<TriggerService<T>>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Monitor>, RepositoryError>> + Send + 'async_trait>>where
'life0: 'async_trait,
fn load_all<'life0, 'async_trait>(
path: Option<&'life0 Path>,
network_service: Option<NetworkService<N>>,
trigger_service: Option<TriggerService<T>>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Monitor>, RepositoryError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Load all monitor configurations from the given path Read more
Auto Trait Implementations§
impl<N, T> Freeze for MonitorRepository<N, T>
impl<N, T> RefUnwindSafe for MonitorRepository<N, T>where
N: RefUnwindSafe,
T: RefUnwindSafe,
impl<N, T> Send for MonitorRepository<N, T>
impl<N, T> Sync for MonitorRepository<N, T>
impl<N, T> Unpin for MonitorRepository<N, T>
impl<N, T> UnwindSafe for MonitorRepository<N, T>where
N: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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