MCPcopy Create free account
hub / github.com/douglance/devsql / restore_from_backup

Method restore_from_backup

crates/ccql/src/sql/safety.rs:101–119  ·  view source on GitHub ↗
(&self, table_name: &str)

Source from the content-addressed store, hash-verified

99 /// Restore a table from its backup
100 #[allow(dead_code)]
101 pub fn restore_from_backup(&self, table_name: &str) -> Result<bool> {
102 let source_path = self.get_table_path(table_name)?;
103 let backup_path = create_backup_path(&source_path);
104
105 if !backup_path.exists() {
106 return Ok(false);
107 }
108
109 fs::copy(&backup_path, &source_path).map_err(|e| {
110 Error::BackupFailed(format!(
111 "Failed to restore {} from {}: {}",
112 source_path.display(),
113 backup_path.display(),
114 e
115 ))
116 })?;
117
118 Ok(true)
119 }
120
121 /// Get the file path for a table
122 fn get_table_path(&self, table_name: &str) -> Result<PathBuf> {

Callers

nothing calls this directly

Calls 2

create_backup_pathFunction · 0.85
get_table_pathMethod · 0.80

Tested by

no test coverage detected