Collect zombie context when deleting content. If we're deleting content that has children or parents from unknown changes (not in our dependencies), those become zombies. A zombie is content that: - We want to delete - But has live connections from changes we don't know about # Arguments `txn` - Transaction for graph queries `workspace` - Workspace to track zombies `change` - Current change fo
(
txn: &T,
workspace: &mut Workspace,
change: &Change,
edge: &NewEdge<Option<Hash>>,
change_id: NodeId,
)
| 325 | /// * `edge` - The deletion edge |
| 326 | /// * `change_id` - Internal ID of current change |
| 327 | fn collect_zombie_context<T: GraphTxnT>( |
| 328 | txn: &T, |
| 329 | workspace: &mut Workspace, |
| 330 | change: &Change, |
| 331 | edge: &NewEdge<Option<Hash>>, |
| 332 | change_id: NodeId, |
| 333 | ) -> Result<(), LocalApplyError> { |
| 334 | // Get the target position range |
| 335 | let start_pos = resolve_position(txn, &edge.to.start_pos(), change_id)?; |
| 336 | let end_pos = resolve_position(txn, &edge.to.end_pos(), change_id)?; |
| 337 | |
| 338 | // Find all vertices in the target range |
| 339 | let mut pos = start_pos; |
| 340 | while let Ok(node) = txn.find_block(pos) { |
| 341 | // Check for non-deleted edges that we don't know about |
| 342 | check_vertex_for_zombies(txn, workspace, change, node, change_id)?; |
| 343 | |
| 344 | // Move to next span in range |
| 345 | if node.end < end_pos.pos { |
| 346 | let next_pos = if node.end == node.start { |
| 347 | // Empty vertex (e.g., inode marker) — skip past it |
| 348 | ChangePosition::new(node.end.get() + 1) |
| 349 | } else { |
| 350 | node.end |
| 351 | }; |
| 352 | if next_pos <= pos.pos { |
| 353 | // Safety: avoid infinite loop if we can't advance |
| 354 | log::warn!( |
| 355 | "collect_zombie_context: pos not advancing at {:?}, breaking", |
| 356 | pos |
| 357 | ); |
| 358 | break; |
| 359 | } |
| 360 | pos.pos = next_pos; |
| 361 | } else { |
| 362 | break; |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | Ok(()) |
| 367 | } |
| 368 | |
| 369 | /// Check a single span for zombie conflicts. |
| 370 | /// |
no test coverage detected