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

Function find_target_vertex

atomic-core/src/apply/edge.rs:296–307  ·  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

294///
295/// Returns `BlockNotFound` if no span contains this position.
296pub fn find_target_vertex<T: GraphTxnT>(
297 txn: &T,
298 pos: Position<NodeId>,
299) -> Result<GraphNode<NodeId>, LocalApplyError> {
300 if pos.change.is_root() {
301 // ROOT span is empty at position 0
302 return Ok(GraphNode::root());
303 }
304
305 txn.find_block(pos)
306 .map_err(|_| LocalApplyError::BlockNotFound { position: pos })
307}
308
309// Deletion Handling
310

Callers

nothing calls this directly

Calls 2

is_rootMethod · 0.45
find_blockMethod · 0.45

Tested by

no test coverage detected