Look up a file's inode and graph position from the pristine. Returns `None` if the file is not tracked or has no graph position.
(
&self,
path: &str,
)
| 4535 | /// |
| 4536 | /// Returns `None` if the file is not tracked or has no graph position. |
| 4537 | pub fn get_inode_and_position( |
| 4538 | &self, |
| 4539 | path: &str, |
| 4540 | ) -> Result<Option<(Inode, Position<NodeId>)>, RepositoryError> { |
| 4541 | use atomic_core::pristine::TreeTxnT; |
| 4542 | |
| 4543 | let txn = self |
| 4544 | .pristine |
| 4545 | .read_txn() |
| 4546 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 4547 | |
| 4548 | let inode = match txn |
| 4549 | .get_inode(path) |
| 4550 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 4551 | { |
| 4552 | Some(i) => i, |
| 4553 | None => return Ok(None), |
| 4554 | }; |
| 4555 | |
| 4556 | let position = match txn |
| 4557 | .inode_position(inode) |
| 4558 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 4559 | { |
| 4560 | Some(p) => p, |
| 4561 | None => return Ok(None), |
| 4562 | }; |
| 4563 | |
| 4564 | Ok(Some((inode, position))) |
| 4565 | } |
| 4566 | |
| 4567 | /// Resolve a recorded path's identity through the canonical graph and an |
| 4568 | /// explicit assembly closure. TREE alone cannot decide whether the path |