reactive_graph_runtime_web_api/
web_resource_manager.rs

1use std::sync::Arc;
2
3use async_trait::async_trait;
4use springtime_di::injectable;
5use uuid::Uuid;
6
7use reactive_graph_lifecycle::Lifecycle;
8use reactive_graph_plugin_api::WebResourceProvider;
9
10#[injectable]
11#[async_trait]
12pub trait WebResourceManager: Send + Sync + Lifecycle {
13    /// Returns true, if a web resource provider exists with the given context path.
14    fn has(&self, context_path: String) -> bool;
15
16    /// Returns the web resource provider with the given context path.
17    fn get(&self, context_path: String) -> Option<Arc<dyn WebResourceProvider>>;
18
19    /// Returns the default web resource provider.
20    fn get_default(&self) -> Option<Arc<dyn WebResourceProvider>>;
21
22    /// Registers a web resource provider.
23    async fn register_provider(&self, web_resource_provider: Arc<dyn WebResourceProvider>);
24
25    /// Unregisters a web resource provider.
26    async fn unregister_provider(&self, id: Uuid);
27}