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

Function source_has_exact_edge

atomic-core/src/apply/edge.rs:361–389  ·  view source on GitHub ↗
(
    txn: &CachedWriteGraphTxn<'_, '_>,
    source: GraphNode<NodeId>,
    target: GraphNode<NodeId>,
    previous: crate::types::EdgeFlags,
    introduced_by: NodeId,
)

Source from the content-addressed store, hash-verified

359}
360
361fn source_has_exact_edge(
362 txn: &CachedWriteGraphTxn<'_, '_>,
363 source: GraphNode<NodeId>,
364 target: GraphNode<NodeId>,
365 previous: crate::types::EdgeFlags,
366 introduced_by: NodeId,
367) -> Result<bool, LocalApplyError> {
368 let adjacent = txn
369 .iter_adjacent(
370 source,
371 crate::types::EdgeFlags::empty(),
372 crate::types::EdgeFlags::all(),
373 )
374 .map_err(|error| LocalApplyError::Internal {
375 message: format!("failed to validate prior edge from {}: {}", source, error),
376 })?;
377 for edge in adjacent {
378 let edge = edge.map_err(|error| LocalApplyError::Internal {
379 message: format!("failed to read prior edge from {}: {}", source, error),
380 })?;
381 if edge.flag() == previous
382 && edge.dest() == target.start_pos()
383 && edge.introduced_by() == introduced_by
384 {
385 return Ok(true);
386 }
387 }
388 Ok(false)
389}
390
391// Span Finding
392

Callers 1

Calls 5

flagMethod · 0.80
iter_adjacentMethod · 0.45
destMethod · 0.45
start_posMethod · 0.45
introduced_byMethod · 0.45

Tested by

no test coverage detected