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

Method materialize_prefix

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

670 ///
671 /// Statistics about the materialize operation.
672 pub fn materialize_prefix(&self, prefix: &str) -> Result<MaterializeResult, RepositoryError> {
673 let txn = self
674 .pristine
675 .read_txn()
676 .map_err(|e| RepositoryError::Database(e.to_string()))?;
677
678 // Get the current view for the change filter
679 let view = txn
680 .get_view(&self.current_view)
681 .map_err(|e| RepositoryError::Database(e.to_string()))?
682 .ok_or_else(|| RepositoryError::ViewNotFound {
683 name: self.current_view.clone(),
684 })?;
685
686 let change_filter = collect_visible_change_ids(&txn, &view)?;
687
688 let cached_txn =
689 CachedGraphTxn::new(&txn).map_err(|e| RepositoryError::Database(e.to_string()))?;
690
691 let working_copy = FileSystem::from_root(&self.root);
692 let options = MaterializeOptions::new()
693 .prefix(prefix)
694 .with_change_filter(change_filter);
695
696 let result = materialize_view(&cached_txn, &self.change_store, &working_copy, options)
697 .map_err(|e| RepositoryError::Output(format!("{}", e)))?;
698
699 self.populate_file_index(&result);
700
701 Ok(result)
702 }
703}

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