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

Function find_target_vertex

atomic-core/src/apply/edge.rs:450–461  ·  view source on GitHub ↗

Find the target span for an edge operation. Given a position, finds the span that contains it. For edge targets, we want the span starting at or containing the position. # Arguments `txn` - Transaction for graph lookups `pos` - Position to find # Returns The span containing the position. # Errors Returns `BlockNotFound` if no span contains this position.

(
    txn: &T,
    pos: Position<NodeId>,
)

Source from the content-addressed store, hash-verified

448///
449/// Returns `BlockNotFound` if no span contains this position.
450pub fn find_target_vertex<T: GraphTxnT>(
451 txn: &T,
452 pos: Position<NodeId>,
453) -> Result<GraphNode<NodeId>, LocalApplyError> {
454 if pos.change.is_root() {
455 // ROOT span is empty at position 0
456 return Ok(GraphNode::root());
457 }
458
459 txn.find_block(pos)
460 .map_err(|_| LocalApplyError::BlockNotFound { position: pos })
461}
462
463// Deletion Handling
464

Callers

nothing calls this directly

Calls 3

rootFunction · 0.85
is_rootMethod · 0.45
find_blockMethod · 0.45

Tested by

no test coverage detected