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

Method update_file_index

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

Store mtime + size + content hash for a batch of files in a single transaction. This populates the file index so that `status` can compare file metadata instead of reconstructing graph content for every file. Call this after git import (or any bulk write that puts files on disk without going through `record`). # Arguments `files` - Slice of `(path, mtime_secs, mtime_nanos, file_size, content_h

(
        &self,
        files: &[(String, i64, u32, u64, Hash)],
    )

Source from the content-addressed store, hash-verified

580 /// * `files` - Slice of `(path, mtime_secs, mtime_nanos, file_size, content_hash)` tuples.
581 /// Paths should be repo-relative with forward slashes.
582 pub fn update_file_index(
583 &self,
584 files: &[(String, i64, u32, u64, Hash)],
585 ) -> Result<(), RepositoryError> {
586 if files.is_empty() {
587 return Ok(());
588 }
589
590 let mut txn = self
591 .pristine
592 .write_txn()
593 .map_err(|e| RepositoryError::Database(e.to_string()))?;
594
595 for (path, secs, nanos, size, hash) in files {
596 txn.put_file_index(path, *secs, *nanos, *size, hash)
597 .map_err(|e| RepositoryError::Database(e.to_string()))?;
598 }
599
600 txn.commit()
601 .map_err(|e| RepositoryError::Database(e.to_string()))?;
602
603 Ok(())
604 }
605
606 /// Rebuild the FILE_INDEX from the current working copy.
607 ///

Callers 4

materialize_parallelMethod · 0.45
populate_file_indexMethod · 0.45
reindex_working_copyMethod · 0.45

Calls 4

write_txnMethod · 0.80
put_file_indexMethod · 0.80
commitMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected