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

Function resolve_inode

atomic-core/src/apply/position.rs:167–184  ·  view source on GitHub ↗

Resolve an inode position to an actual Inode value. Given a position referencing a file's inode span, looks up the actual Inode value from the position→inode mapping. # Arguments `txn` - Transaction for lookups `inode_pos` - Position of the inode span `current_change` - NodeId of the change being applied # Returns `Ok(Some(inode))` - The resolved inode `Ok(None)` - Position is ROOT or inode n

(
    txn: &T,
    inode_pos: &Position<Option<Hash>>,
    current_change: NodeId,
)

Source from the content-addressed store, hash-verified

165/// ROOT positions don't have an associated inode, so this returns `None`
166/// for those cases.
167pub fn resolve_inode<T: GraphTxnT + TreeTxnT>(
168 txn: &T,
169 inode_pos: &Position<Option<Hash>>,
170 current_change: NodeId,
171) -> Result<Option<Inode>, LocalApplyError> {
172 let internal_pos = resolve_position(txn, inode_pos, current_change)?;
173
174 // ROOT positions don't have an associated inode
175 if internal_pos.change.is_root() {
176 return Ok(None);
177 }
178
179 // Look up the Inode from the position
180 txn.position_inode(internal_pos)
181 .map_err(|e| LocalApplyError::Internal {
182 message: format!("Failed to resolve inode: {}", e),
183 })
184}
185
186/// Resolve the `introduced_by` field of an edge.
187///

Callers 2

write_new_edgeFunction · 0.85
write_new_vertexFunction · 0.85

Calls 3

resolve_positionFunction · 0.85
is_rootMethod · 0.45
position_inodeMethod · 0.45

Tested by

no test coverage detected