openzeppelin_monitor::repositories

Trait TriggerRepositoryTrait

Source
pub trait TriggerRepositoryTrait: Clone {
    // Required methods
    fn new<'life0, 'async_trait>(
        path: Option<&'life0 Path>,
    ) -> 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>,
    ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Trigger>, RepositoryError>> + Send + 'async_trait>>
       where 'life0: 'async_trait;
    fn get(&self, trigger_id: &str) -> Option<Trigger>;
    fn get_all(&self) -> HashMap<String, Trigger>;
}
Expand description

Interface for trigger repository implementations

This trait defines the standard operations that any trigger 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>, ) -> Pin<Box<dyn Future<Output = Result<Self, RepositoryError>> + Send + 'async_trait>>
where Self: Sized + 'async_trait, 'life0: 'async_trait,

Create a new trigger repository from the given path

Source

fn load_all<'life0, 'async_trait>( path: Option<&'life0 Path>, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Trigger>, RepositoryError>> + Send + 'async_trait>>
where 'life0: 'async_trait,

Load all trigger configurations from the given path

If no path is provided, uses the default config directory. This is a static method that doesn’t require an instance.

Source

fn get(&self, trigger_id: &str) -> Option<Trigger>

Get a specific trigger by ID

Returns None if the trigger doesn’t exist.

Source

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

Get all triggers

Returns a copy of the trigger 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§