openzeppelin_monitor::repositories

Trait NetworkRepositoryTrait

Source
pub trait NetworkRepositoryTrait: 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, Network>, RepositoryError>> + Send + 'async_trait>>
       where 'life0: 'async_trait;
    fn get(&self, network_id: &str) -> Option<Network>;
    fn get_all(&self) -> HashMap<String, Network>;
}
Expand description

Interface for network repository implementations

This trait defines the standard operations that any network 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 repository instance

Source

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

Load all network 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, network_id: &str) -> Option<Network>

Get a specific network by ID

Returns None if the network doesn’t exist.

Source

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

Get all networks

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