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

Method del_file_index_batch

atomic-repository/src/repository/tracking.rs:794–818  ·  view source on GitHub ↗

Remove multiple files from the FILE_INDEX in a single write transaction. This is much faster than calling `del_file_index()` in a loop because it avoids a separate write transaction (and fsync) for each file. # Arguments `working_copy` - Identity of the physical working copy owning the index `paths` - Paths to remove from the index

(
        &self,
        working_copy: WorkingCopyId,
        paths: &[&str],
    )

Source from the content-addressed store, hash-verified

792 /// * `working_copy` - Identity of the physical working copy owning the index
793 /// * `paths` - Paths to remove from the index
794 pub fn del_file_index_batch(
795 &self,
796 working_copy: WorkingCopyId,
797 paths: &[&str],
798 ) -> Result<(), RepositoryError> {
799 self.validate_working_copy(working_copy)?;
800 if paths.is_empty() {
801 return Ok(());
802 }
803
804 let mut txn = self
805 .pristine
806 .write_txn()
807 .map_err(|e| RepositoryError::Database(e.to_string()))?;
808
809 for path in paths {
810 let normalized = path.replace('\\', "/");
811 let _ = txn.del_working_copy_file_index(working_copy, &normalized);
812 }
813
814 txn.commit()
815 .map_err(|e| RepositoryError::Database(e.to_string()))?;
816
817 Ok(())
818 }
819
820 /// Store mtime + size + content hash for a batch of files in a single transaction.
821 ///

Callers 3

split_viewMethod · 0.45

Calls 6

validate_working_copyMethod · 0.80
write_txnMethod · 0.80
is_emptyMethod · 0.45
replaceMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected