Resolve a position to a vertex in the graph. Uses `find_block` for forward context (containing position) and `find_block_end` for predecessor context (ending at position).
(
txn: &T,
pos: Position<NodeId>,
is_predecessor: bool,
)
| 110 | /// Uses `find_block` for forward context (containing position) and |
| 111 | /// `find_block_end` for predecessor context (ending at position). |
| 112 | pub(super) fn resolve_vertex<T: GraphTxnT>( |
| 113 | txn: &T, |
| 114 | pos: Position<NodeId>, |
| 115 | is_predecessor: bool, |
| 116 | ) -> Result<GraphNode<NodeId>, LocalApplyError> { |
| 117 | if pos.change.is_root() { |
| 118 | return Ok(GraphNode::root()); |
| 119 | } |
| 120 | |
| 121 | if is_predecessor { |
| 122 | txn.find_block_end(pos) |
| 123 | } else { |
| 124 | txn.find_block(pos) |
| 125 | } |
| 126 | .map_err(|_| LocalApplyError::BlockNotFound { position: pos }) |
| 127 | } |
| 128 | |
| 129 | /// Write a single NewEdge operation to the graph. |
| 130 | /// |
no test coverage detected