Record a Git SHA → Atomic change mapping in the GIT_SHA_INDEX. Called after each commit is imported to enable O(1) incremental lookups. The `change_hash` is the Atomic Blake3 hash returned by write_import_*.
(&self, git_sha: &str, change_hash: &Hash)
| 2674 | /// Called after each commit is imported to enable O(1) incremental lookups. |
| 2675 | /// The `change_hash` is the Atomic Blake3 hash returned by write_import_*. |
| 2676 | pub fn index_git_sha(&self, git_sha: &str, change_hash: &Hash) -> Result<(), RepositoryError> { |
| 2677 | use atomic_core::pristine::GitShaIndexMutTxnT; |
| 2678 | |
| 2679 | let mut txn = self |
| 2680 | .pristine |
| 2681 | .write_txn() |
| 2682 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 2683 | |
| 2684 | // Get the entity_id for this change hash |
| 2685 | let entity_id = txn |
| 2686 | .get_internal(change_hash) |
| 2687 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 2688 | .ok_or_else(|| { |
| 2689 | RepositoryError::Database(format!( |
| 2690 | "Change hash not found in INTERNAL: {}", |
| 2691 | change_hash.to_base32() |
| 2692 | )) |
| 2693 | })?; |
| 2694 | |
| 2695 | txn.put_git_sha(git_sha, entity_id) |
| 2696 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 2697 | |
| 2698 | txn.commit() |
| 2699 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 2700 | |
| 2701 | Ok(()) |
| 2702 | } |
| 2703 | |
| 2704 | /// Record missing Git SHA → Atomic change mappings in one transaction. |
| 2705 | /// |
no test coverage detected