openzeppelin_monitor::repositories

Trait MonitorRepositoryTrait

Source
pub trait MonitorRepositoryTrait<N: NetworkRepositoryTrait + Send + 'static, T: TriggerRepositoryTrait + Send + 'static>: Clone + Send {
    // Required methods
    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: Sized + 'async_trait,
             '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;
    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 get(&self, monitor_id: &str) -> Option<Monitor>;
    fn get_all(&self) -> HashMap<String, Monitor>;
}
Expand description

Interface for monitor repository implementations

This trait defines the standard operations that any monitor repository must support, allowing for different storage backends while maintaining a consistent interface.

Required Methods§

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: Sized + '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,

Load all monitor configurations from the given path

If no path is provided, uses the default config directory. Also validates references to networks and triggers. This is a static method that doesn’t require an instance.

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,

Load a monitor from a specific path

Loads a monitor configuration from a specific path and validates all network and trigger references.

Source

fn get(&self, monitor_id: &str) -> Option<Monitor>

Get a specific monitor by ID

Returns None if the monitor doesn’t exist.

Source

fn get_all(&self) -> HashMap<String, Monitor>

Get all monitors

Returns a copy of the monitor map to prevent external mutation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§