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,
)
| 137 | /// Uses `find_block` for forward context (containing position) and |
| 138 | /// `find_block_end` for predecessor context (ending at position). |
| 139 | pub(super) fn resolve_vertex<T: GraphTxnT>( |
| 140 | txn: &T, |
| 141 | pos: Position<NodeId>, |
| 142 | is_predecessor: bool, |
| 143 | ) -> Result<GraphNode<NodeId>, LocalApplyError> { |
| 144 | if pos.change.is_root() { |
| 145 | return Ok(GraphNode::root()); |
| 146 | } |
| 147 | |
| 148 | if is_predecessor { |
| 149 | txn.find_block_end(pos) |
| 150 | } else { |
| 151 | txn.find_block(pos) |
| 152 | } |
| 153 | .map_err(|_| LocalApplyError::BlockNotFound { position: pos }) |
| 154 | } |
| 155 | |
| 156 | /// Write a single NewEdge operation to the graph. |
| 157 | /// |
no test coverage detected