reactive_graph_plugin_delegates/
relation_type_import_export_manager_impl.rs1use std::sync::Arc;
2
3use async_trait::async_trait;
4
5use reactive_graph_graph::RelationType;
6use reactive_graph_graph::RelationTypeId;
7use reactive_graph_type_system_api::RelationTypeExportError;
8use reactive_graph_type_system_api::RelationTypeImportError;
9
10pub struct RelationTypeImportExportManagerDelegate {
11 relation_type_import_export_manager: Arc<dyn reactive_graph_type_system_api::RelationTypeImportExportManager + Send + Sync>,
12}
13
14impl RelationTypeImportExportManagerDelegate {
15 pub fn new(relation_type_manager: Arc<dyn reactive_graph_type_system_api::RelationTypeImportExportManager + Send + Sync>) -> Self {
16 Self {
17 relation_type_import_export_manager: relation_type_manager,
18 }
19 }
20}
21
22#[async_trait]
23impl reactive_graph_plugin_api::RelationTypeImportExportManager for RelationTypeImportExportManagerDelegate {
24 async fn import(&self, path: &str) -> Result<RelationType, RelationTypeImportError> {
25 self.relation_type_import_export_manager.import(path).await
26 }
27
28 async fn export(&self, ty: &RelationTypeId, path: &str) -> Result<(), RelationTypeExportError> {
29 self.relation_type_import_export_manager.export(ty, path).await
30 }
31}