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

Method get_inode_and_position

atomic-repository/src/repository/record.rs:937–965  ·  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

935 ///
936 /// Returns `None` if the file is not tracked or has no graph position.
937 pub fn get_inode_and_position(
938 &self,
939 path: &str,
940 ) -> Result<Option<(Inode, Position<NodeId>)>, RepositoryError> {
941 use atomic_core::pristine::TreeTxnT;
942
943 let txn = self
944 .pristine
945 .read_txn()
946 .map_err(|e| RepositoryError::Database(e.to_string()))?;
947
948 let inode = match txn
949 .get_inode(path)
950 .map_err(|e| RepositoryError::Database(e.to_string()))?
951 {
952 Some(i) => i,
953 None => return Ok(None),
954 };
955
956 let position = match txn
957 .inode_position(inode)
958 .map_err(|e| RepositoryError::Database(e.to_string()))?
959 {
960 Some(p) => p,
961 None => return Ok(None),
962 };
963
964 Ok(Some((inode, position)))
965 }
966
967 /// Record all changes with a message.
968 ///

Callers 4

write_commitMethod · 0.80

Calls 3

read_txnMethod · 0.80
get_inodeMethod · 0.45
inode_positionMethod · 0.45

Tested by 3