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