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],
)
| 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 | /// |
no test coverage detected