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

Method get_inode_and_position

atomic-repository/src/repository/record.rs:958–986  ·  view source on GitHub ↗

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,
    )

Source from the content-addressed store, hash-verified

956 ///
957 /// Returns `None` if the file is not tracked or has no graph position.
958 pub fn get_inode_and_position(
959 &self,
960 path: &str,
961 ) -> Result<Option<(Inode, Position<NodeId>)>, RepositoryError> {
962 use atomic_core::pristine::TreeTxnT;
963
964 let txn = self
965 .pristine
966 .read_txn()
967 .map_err(|e| RepositoryError::Database(e.to_string()))?;
968
969 let inode = match txn
970 .get_inode(path)
971 .map_err(|e| RepositoryError::Database(e.to_string()))?
972 {
973 Some(i) => i,
974 None => return Ok(None),
975 };
976
977 let position = match txn
978 .inode_position(inode)
979 .map_err(|e| RepositoryError::Database(e.to_string()))?
980 {
981 Some(p) => p,
982 None => return Ok(None),
983 };
984
985 Ok(Some((inode, position)))
986 }
987
988 /// Record all changes with a message.
989 ///

Callers 4

write_commitMethod · 0.80

Calls 3

read_txnMethod · 0.80
get_inodeMethod · 0.45
inode_positionMethod · 0.45

Tested by 3