pub struct ModelSaver<B>where
B: StorageBackend,{ /* private fields */ }Expand description
Model saver that uses a storage backend
Implementations§
Source§impl<B> ModelSaver<B>where
B: StorageBackend,
impl<B> ModelSaver<B>where
B: StorageBackend,
Sourcepub fn new(storage: B) -> ModelSaver<B>
pub fn new(storage: B) -> ModelSaver<B>
Create a new model saver with the given storage backend
Sourcepub async fn save_table(
&self,
workspace_path: &str,
table: &TableData,
) -> Result<(), StorageError>
pub async fn save_table( &self, workspace_path: &str, table: &TableData, ) -> Result<(), StorageError>
Save a table to storage
Saves the table as a YAML file in the workspace’s tables/ directory.
The filename will be based on the table name if yaml_file_path is not provided.
Sourcepub async fn save_relationships(
&self,
workspace_path: &str,
relationships: &[RelationshipData],
) -> Result<(), StorageError>
pub async fn save_relationships( &self, workspace_path: &str, relationships: &[RelationshipData], ) -> Result<(), StorageError>
Save relationships to storage
Saves relationships to relationships.yaml in the workspace directory.
Note: Relationships are now stored within domain.yaml files, but this method
is kept for backward compatibility.
Sourcepub async fn save_domain(
&self,
workspace_path: &str,
domain: &Domain,
tables: &HashMap<Uuid, Table>,
odps_products: &HashMap<Uuid, ODPSDataProduct>,
cads_assets: &HashMap<Uuid, CADSAsset>,
) -> Result<(), StorageError>
pub async fn save_domain( &self, workspace_path: &str, domain: &Domain, tables: &HashMap<Uuid, Table>, odps_products: &HashMap<Uuid, ODPSDataProduct>, cads_assets: &HashMap<Uuid, CADSAsset>, ) -> Result<(), StorageError>
Save a domain to storage
Saves the domain as domain.yaml in a domain directory named after the domain.
Also saves all associated ODCS tables, ODPS products, and CADS assets within the domain directory.
Sourcepub async fn save_odps_product(
&self,
workspace_path: &str,
domain_name: &str,
product: &ODPSDataProduct,
) -> Result<(), StorageError>
pub async fn save_odps_product( &self, workspace_path: &str, domain_name: &str, product: &ODPSDataProduct, ) -> Result<(), StorageError>
Save an ODPS product to a domain directory
Saves the product as {product_name}.odps.yaml in the specified domain directory.
Sourcepub async fn save_cads_asset(
&self,
workspace_path: &str,
domain_name: &str,
asset: &CADSAsset,
) -> Result<(), StorageError>
pub async fn save_cads_asset( &self, workspace_path: &str, domain_name: &str, asset: &CADSAsset, ) -> Result<(), StorageError>
Save a CADS asset to a domain directory
Saves the asset as {asset_name}.cads.yaml in the specified domain directory.
Sourcepub async fn save_decision(
&self,
workspace_path: &str,
workspace_name: &str,
decision: &Decision,
) -> Result<String, StorageError>
pub async fn save_decision( &self, workspace_path: &str, workspace_name: &str, decision: &Decision, ) -> Result<String, StorageError>
Save a decision to storage
Saves the decision as a YAML file using the naming convention:
{workspace}_{domain}_adr-{number}.madr.yaml (with domain)
or {workspace}_adr-{number}.madr.yaml (without domain)
§Arguments
workspace_path- Path to the workspace directoryworkspace_name- Name of the workspace for filename generationdecision- The decision to save
Sourcepub async fn save_decision_index(
&self,
workspace_path: &str,
index: &DecisionIndex,
) -> Result<(), StorageError>
pub async fn save_decision_index( &self, workspace_path: &str, index: &DecisionIndex, ) -> Result<(), StorageError>
Save the decision index to decisions.yaml
§Arguments
workspace_path- Path to the workspace directoryindex- The decision index to save
Sourcepub async fn save_knowledge(
&self,
workspace_path: &str,
workspace_name: &str,
article: &KnowledgeArticle,
) -> Result<String, StorageError>
pub async fn save_knowledge( &self, workspace_path: &str, workspace_name: &str, article: &KnowledgeArticle, ) -> Result<String, StorageError>
Save a knowledge article to storage
Saves the article as a YAML file using the naming convention:
{workspace}_{domain}_kb-{number}.kb.yaml (with domain)
or {workspace}_kb-{number}.kb.yaml (without domain)
§Arguments
workspace_path- Path to the workspace directoryworkspace_name- Name of the workspace for filename generationarticle- The knowledge article to save
Sourcepub async fn save_knowledge_index(
&self,
workspace_path: &str,
index: &KnowledgeIndex,
) -> Result<(), StorageError>
pub async fn save_knowledge_index( &self, workspace_path: &str, index: &KnowledgeIndex, ) -> Result<(), StorageError>
Save the knowledge index to knowledge.yaml
§Arguments
workspace_path- Path to the workspace directoryindex- The knowledge index to save
Sourcepub async fn export_decision_markdown(
&self,
workspace_path: &str,
decision: &Decision,
) -> Result<String, StorageError>
pub async fn export_decision_markdown( &self, workspace_path: &str, decision: &Decision, ) -> Result<String, StorageError>
Export a decision to Markdown
Saves the decision as a Markdown file in the decisions/ subdirectory
using the filename format: ADR-NNNN-slug.md
§Arguments
workspace_path- Path to the workspace directorydecision- The decision to export
Sourcepub async fn export_knowledge_markdown(
&self,
workspace_path: &str,
article: &KnowledgeArticle,
) -> Result<String, StorageError>
pub async fn export_knowledge_markdown( &self, workspace_path: &str, article: &KnowledgeArticle, ) -> Result<String, StorageError>
Export a knowledge article to Markdown
Saves the article as a Markdown file in the knowledge/ subdirectory
using the filename format: KB-NNNN-slug.md
§Arguments
workspace_path- Path to the workspace directoryarticle- The knowledge article to export