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

Method materialize_prefix

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

916 ///
917 /// Statistics about the materialize operation.
918 pub fn materialize_prefix(&self, prefix: &str) -> Result<MaterializeResult, RepositoryError> {
919 let txn = self
920 .pristine
921 .read_txn()
922 .map_err(|e| RepositoryError::Database(e.to_string()))?;
923
924 // Get the current view for the change filter
925 let view = txn
926 .get_view(&self.current_view)
927 .map_err(|e| RepositoryError::Database(e.to_string()))?
928 .ok_or_else(|| RepositoryError::ViewNotFound {
929 name: self.current_view.clone(),
930 })?;
931
932 let change_filter = collect_visible_change_ids(&txn, &view)?;
933
934 let cached_txn =
935 CachedGraphTxn::new(&txn).map_err(|e| RepositoryError::Database(e.to_string()))?;
936
937 let working_copy = FileSystem::from_root(&self.root);
938 let options = MaterializeOptions::new()
939 .prefix(prefix)
940 .with_change_filter(change_filter);
941
942 let result = materialize_view(&cached_txn, &self.change_store, &working_copy, options)
943 .map_err(|e| RepositoryError::Output(format!("{}", e)))?;
944
945 self.populate_file_index(&result);
946
947 Ok(result)
948 }
949}

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