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

Method del_file_index_batch

atomic-repository/src/repository/tracking.rs:550–569  ·  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 `paths` - Paths to remove from the index

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

Source from the content-addressed store, hash-verified

548 ///
549 /// * `paths` - Paths to remove from the index
550 pub fn del_file_index_batch(&self, paths: &[&str]) -> Result<(), RepositoryError> {
551 if paths.is_empty() {
552 return Ok(());
553 }
554
555 let mut txn = self
556 .pristine
557 .write_txn()
558 .map_err(|e| RepositoryError::Database(e.to_string()))?;
559
560 for path in paths {
561 let normalized = path.replace('\\', "/");
562 let _ = txn.del_file_index(&normalized);
563 }
564
565 txn.commit()
566 .map_err(|e| RepositoryError::Database(e.to_string()))?;
567
568 Ok(())
569 }
570
571 /// Store mtime + size + content hash for a batch of files in a single transaction.
572 ///

Callers 1

write_commitMethod · 0.80

Calls 5

write_txnMethod · 0.80
commitMethod · 0.80
is_emptyMethod · 0.45
replaceMethod · 0.45
del_file_indexMethod · 0.45

Tested by

no test coverage detected