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

Method update_file_index

atomic-repository/src/repository/tracking.rs:832–856  ·  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 `working_copy` - Identity of the physical working copy owning the index

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

Source from the content-addressed store, hash-verified

830 /// * `files` - Slice of `(path, mtime_secs, mtime_nanos, file_size, content_hash)` tuples.
831 /// Paths should be repo-relative with forward slashes.
832 pub fn update_file_index(
833 &self,
834 working_copy: WorkingCopyId,
835 files: &[(String, i64, u32, u64, Hash)],
836 ) -> Result<(), RepositoryError> {
837 self.validate_working_copy(working_copy)?;
838 if files.is_empty() {
839 return Ok(());
840 }
841
842 let mut txn = self
843 .pristine
844 .write_txn()
845 .map_err(|e| RepositoryError::Database(e.to_string()))?;
846
847 for (path, secs, nanos, size, hash) in files {
848 txn.put_working_copy_file_index(working_copy, path, *secs, *nanos, *size, hash)
849 .map_err(|e| RepositoryError::Database(e.to_string()))?;
850 }
851
852 txn.commit()
853 .map_err(|e| RepositoryError::Database(e.to_string()))?;
854
855 Ok(())
856 }
857
858 /// Rebuild the FILE_INDEX from the current working copy.
859 ///

Callers 1

reindex_working_copyMethod · 0.45

Calls 5

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

Tested by

no test coverage detected