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

Function resolve_vertex

atomic-core/src/apply/edge.rs:112–127  ·  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

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

Callers 1

write_new_edgeFunction · 0.70

Calls 3

is_rootMethod · 0.45
find_block_endMethod · 0.45
find_blockMethod · 0.45

Tested by

no test coverage detected