Choose the single live successor of `current` for a linear content walk. In the additive graph model a deleted destination can still lead to live descendants. Even when there is exactly one direct live successor, walking only that successor may skip an insertion reachable through the dead chain. Any visible deletion therefore requires the full graph traversal, which contracts dead chains and pres
(
txn: &T,
inode: Inode,
adj: &mut atomic_core::pristine::InodeAdjState,
options: &atomic_core::output::alive::RetrieveOptions,
)
| 1394 | /// Any visible deletion therefore requires the full graph traversal, which |
| 1395 | /// contracts dead chains and preserves their ordering and concurrent branches. |
| 1396 | fn select_linear_successor<T>( |
| 1397 | txn: &T, |
| 1398 | inode: Inode, |
| 1399 | adj: &mut atomic_core::pristine::InodeAdjState, |
| 1400 | options: &atomic_core::output::alive::RetrieveOptions, |
| 1401 | ) -> atomic_core::record::RecordResult<LinearStep> |
| 1402 | where |
| 1403 | T: atomic_core::pristine::GraphTxnT |
| 1404 | + atomic_core::pristine::InodeGraphOps<InodeError = atomic_core::pristine::PristineError>, |
| 1405 | { |
| 1406 | use atomic_core::types::EdgeFlags; |
| 1407 | |
| 1408 | let mut alive: Vec<atomic_core::types::GraphNode<NodeId>> = Vec::new(); |
| 1409 | let mut has_deleted_successor = false; |
| 1410 | |
| 1411 | while let Some(edge_result) = txn.next_inode_adj(adj) { |
| 1412 | let edge = edge_result?; |
| 1413 | let flags = edge.flag(); |
| 1414 | if flags.contains(EdgeFlags::PARENT) |
| 1415 | || flags.contains(EdgeFlags::PSEUDO) |
| 1416 | || flags.contains(EdgeFlags::FOLDER) |
| 1417 | { |
| 1418 | continue; |
| 1419 | } |
| 1420 | if !options.passes_filter(edge.introduced_by()) { |
| 1421 | continue; |
| 1422 | } |
| 1423 | let edge_dest = edge.dest(); |
| 1424 | let dest = txn.find_block_in_inode(inode, edge_dest)?.ok_or_else(|| { |
| 1425 | atomic_core::pristine::PristineError::BlockNotFound { |
| 1426 | change: edge_dest.change.get(), |
| 1427 | pos: edge_dest.pos.get(), |
| 1428 | } |
| 1429 | })?; |
| 1430 | if !options.passes_filter(dest.change) { |
| 1431 | continue; |
| 1432 | } |
| 1433 | if flags.contains(EdgeFlags::DELETED) { |
| 1434 | has_deleted_successor = true; |
| 1435 | } else if !alive.contains(&dest) { |
| 1436 | alive.push(dest); |
| 1437 | } |
| 1438 | } |
| 1439 | |
| 1440 | if has_deleted_successor { |
| 1441 | return Ok(LinearStep::Bail); |
| 1442 | } |
| 1443 | |
| 1444 | match alive.len() { |
| 1445 | 0 => Ok(LinearStep::End), |
| 1446 | 1 => Ok(LinearStep::Follow(alive[0])), |
| 1447 | _ => Ok(LinearStep::Bail), |
| 1448 | } |
| 1449 | } |
| 1450 | |
| 1451 | fn try_retrieve_linear_content_with_filter<T, C>( |
| 1452 | txn: &T, |
no test coverage detected