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

Method materialize_prefix

atomic-repository/src/repository/materialize.rs:992–1022  ·  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

990 ///
991 /// Statistics about the materialize operation.
992 pub fn materialize_prefix(&self, prefix: &str) -> Result<MaterializeResult, RepositoryError> {
993 let txn = self
994 .pristine
995 .read_txn()
996 .map_err(|e| RepositoryError::Database(e.to_string()))?;
997
998 // Get the current view for the change filter
999 let view = txn
1000 .get_view(&self.current_view)
1001 .map_err(|e| RepositoryError::Database(e.to_string()))?
1002 .ok_or_else(|| RepositoryError::ViewNotFound {
1003 name: self.current_view.clone(),
1004 })?;
1005
1006 let change_filter = collect_visible_change_ids(&txn, &view)?;
1007
1008 let cached_txn =
1009 CachedGraphTxn::new(&txn).map_err(|e| RepositoryError::Database(e.to_string()))?;
1010
1011 let working_copy = FileSystem::from_root(&self.root);
1012 let options = MaterializeOptions::new()
1013 .prefix(prefix)
1014 .with_change_filter(change_filter);
1015
1016 let result = materialize_view(&cached_txn, &self.change_store, &working_copy, options)
1017 .map_err(|e| RepositoryError::Output(format!("{}", e)))?;
1018
1019 self.populate_file_index(&result);
1020
1021 Ok(result)
1022 }
1023}
1024
1025#[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