MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / save_catalog

Method save_catalog

graphlite/src/catalog/registry.rs:131–156  ·  view source on GitHub ↗

Save a specific catalog to storage Saves the state of a single catalog to storage using the catalog's save method. # Arguments `catalog_name` - Name of the catalog to save # Returns `Ok(())` if catalog saved successfully `Err(CatalogError::CatalogNotFound)` if catalog doesn't exist `Err(CatalogError)` if save operation fails

(&self, catalog_name: &str)

Source from the content-addressed store, hash-verified

129 /// * `Err(CatalogError::CatalogNotFound)` if catalog doesn't exist
130 /// * `Err(CatalogError)` if save operation fails
131 pub fn save_catalog(&self, catalog_name: &str) -> CatalogResult<()> {
132 let catalog = self
133 .catalogs
134 .get(catalog_name)
135 .ok_or_else(|| CatalogError::CatalogNotFound(catalog_name.to_string()))?;
136
137 let data = catalog.save().map_err(|e| {
138 CatalogError::OperationFailed(format!(
139 "Failed to save catalog '{}': {}",
140 catalog_name, e
141 ))
142 })?;
143
144 // Save catalog provider data to storage
145 self.storage
146 .save_catalog_provider(catalog_name, &data)
147 .map_err(|e| {
148 CatalogError::OperationFailed(format!(
149 "Failed to persist catalog '{}': {}",
150 catalog_name, e
151 ))
152 })?;
153
154 log::debug!("Saved catalog '{}': {} bytes", catalog_name, data.len());
155 Ok(())
156 }
157
158 /// Save all catalogs to storage
159 ///

Callers 1

persist_catalogMethod · 0.45

Calls 3

getMethod · 0.45
saveMethod · 0.45
save_catalog_providerMethod · 0.45

Tested by

no test coverage detected