MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / resolve_vertex

Function resolve_vertex

atomic-core/src/apply/edge.rs:139–154  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

137/// Uses `find_block` for forward context (containing position) and
138/// `find_block_end` for predecessor context (ending at position).
139pub(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///

Callers 1

write_new_edgeFunction · 0.70

Calls 4

rootFunction · 0.85
is_rootMethod · 0.45
find_block_endMethod · 0.45
find_blockMethod · 0.45

Tested by

no test coverage detected