MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / materialize_prefix

Method materialize_prefix

atomic-repository/src/repository/materialize.rs:1084–1114  ·  view source on GitHub ↗

Materialize the working copy for a specific prefix only. This is useful for partial updates when you only want to sync a subset of files. # Arguments `prefix` - Path prefix to materialize (e.g., "src/") # Returns Statistics about the materialize operation.

(&self, prefix: &str)

Source from the content-addressed store, hash-verified

1082 ///
1083 /// Statistics about the materialize operation.
1084 pub fn materialize_prefix(&self, prefix: &str) -> Result<MaterializeResult, RepositoryError> {
1085 let txn = self
1086 .pristine
1087 .read_txn()
1088 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1089
1090 // Get the current view for the change filter
1091 let view = txn
1092 .get_view(&self.current_view)
1093 .map_err(|e| RepositoryError::Database(e.to_string()))?
1094 .ok_or_else(|| RepositoryError::ViewNotFound {
1095 name: self.current_view.clone(),
1096 })?;
1097
1098 let change_filter = collect_visible_change_ids(&txn, &view)?;
1099
1100 let cached_txn =
1101 CachedGraphTxn::new(&txn).map_err(|e| RepositoryError::Database(e.to_string()))?;
1102
1103 let working_copy = FileSystem::from_root(&self.root);
1104 let options = MaterializeOptions::new()
1105 .prefix(prefix)
1106 .with_change_filter(change_filter);
1107
1108 let result = materialize_view(&cached_txn, &self.change_store, &working_copy, options)
1109 .map_err(|e| RepositoryError::Output(format!("{}", e)))?;
1110
1111 self.populate_file_index(&result);
1112
1113 Ok(result)
1114 }
1115}
1116
1117#[cfg(test)]

Callers

nothing calls this directly

Calls 8

materialize_viewFunction · 0.85
read_txnMethod · 0.80
populate_file_indexMethod · 0.80
get_viewMethod · 0.45
cloneMethod · 0.45
with_change_filterMethod · 0.45
prefixMethod · 0.45

Tested by

no test coverage detected