Find the source span for an edge operation. Given a position, finds the span whose END matches this position. For edge sources, we want the span ENDING at the position because edges originate from the END of the predecessor span. For example, if we have: - Inode span V\[17:17\] (empty) - Content span V\[17:27\] And we want to find the source for an edge at position 17, we want the inode span V\
(
txn: &T,
pos: Position<NodeId>,
)
| 263 | /// |
| 264 | /// Returns `BlockNotFound` if no span ends at this position. |
| 265 | pub fn find_source_vertex<T: GraphTxnT>( |
| 266 | txn: &T, |
| 267 | pos: Position<NodeId>, |
| 268 | ) -> Result<GraphNode<NodeId>, LocalApplyError> { |
| 269 | if pos.change.is_root() { |
| 270 | // ROOT span is empty at position 0 |
| 271 | return Ok(GraphNode::root()); |
| 272 | } |
| 273 | |
| 274 | // Use find_block_end because edge sources reference the END of a span |
| 275 | txn.find_block_end(pos) |
| 276 | .map_err(|_| LocalApplyError::BlockNotFound { position: pos }) |
| 277 | } |
| 278 | |
| 279 | /// Find the target span for an edge operation. |
| 280 | /// |
nothing calls this directly
no test coverage detected