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>,
)
| 448 | /// |
| 449 | /// Returns `BlockNotFound` if no span contains this position. |
| 450 | pub 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 |
nothing calls this directly
no test coverage detected