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

Function visible_chain_reaches

atomic-core/src/output/alive/retrieve/mod.rs:570–616  ·  view source on GitHub ↗
(
    txn: &T,
    options: &RetrieveOptions,
    start: GraphNode<NodeId>,
    target: GraphNode<NodeId>,
)

Source from the content-addressed store, hash-verified

568}
569
570fn visible_chain_reaches<T: GraphTxnT>(
571 txn: &T,
572 options: &RetrieveOptions,
573 start: GraphNode<NodeId>,
574 target: GraphNode<NodeId>,
575) -> bool {
576 if start == target {
577 return true;
578 }
579
580 let mut stack = vec![start];
581 let mut seen = std::collections::HashSet::new();
582
583 while let Some(current) = stack.pop() {
584 if !seen.insert(current) {
585 continue;
586 }
587
588 let edges = match txn.iter_forward(current, true) {
589 Ok(edges) => edges,
590 Err(_) => continue,
591 };
592
593 for edge in edges {
594 if edge.kind.is_pseudo() {
595 continue;
596 }
597
598 let next = match txn.find_block(edge.dest) {
599 Ok(next) => next,
600 Err(_) => continue,
601 };
602
603 if !options.passes_filter(next.change) {
604 continue;
605 }
606
607 if next == target {
608 return true;
609 }
610
611 stack.push(next);
612 }
613 }
614
615 false
616}
617
618fn alive_graph_reaches(graph: &AliveGraph, from: VertexId, target: VertexId) -> bool {
619 if from == target {

Callers 1

walk_through_deadFunction · 0.85

Calls 6

iter_forwardMethod · 0.80
passes_filterMethod · 0.80
insertMethod · 0.45
is_pseudoMethod · 0.45
find_blockMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected