(
txn: &mut CachedWriteGraphTxn<'_, '_>,
workspace: &mut Workspace,
conflict_tracker: &mut ConflictTracker,
change_id: NodeId,
graph_op: &GraphOp<Option<Hash>>,
change: &Change
| 648 | /// `cached`, so the GRAPH/INODE_GRAPH tables are never reopened mid-hunk. |
| 649 | #[allow(clippy::too_many_arguments)] |
| 650 | fn write_hunk( |
| 651 | txn: &mut CachedWriteGraphTxn<'_, '_>, |
| 652 | workspace: &mut Workspace, |
| 653 | conflict_tracker: &mut ConflictTracker, |
| 654 | change_id: NodeId, |
| 655 | graph_op: &GraphOp<Option<Hash>>, |
| 656 | change: &Change, |
| 657 | verified_frontier: &atomic_core::change::VerifiedCausalFrontier, |
| 658 | options: &InsertOptions, |
| 659 | stats: &mut InsertStats, |
| 660 | ) -> InsertResult<()> { |
| 661 | // Conflict detection (zombie / deleted-context scanning) is only meaningful |
| 662 | // when applying a change that may race with content the change doesn't know |
| 663 | // about — i.e. cross-view insert. A freshly-recorded change applied to its |
| 664 | // own view (write_recorded sets `track_conflicts = false`) has a complete |
| 665 | // dependency closure by construction and cannot conflict, so we skip the |
| 666 | // scans. They only populate the conflict report; the graph written is |
| 667 | // identical either way. |
| 668 | let detect_conflicts = options.track_conflicts; |
| 669 | for atom_ref in graph_op.atoms() { |
| 670 | match atom_ref { |
| 671 | AtomRef::Insertion(insertion) => { |
| 672 | write_new_vertex_with_frontier( |
| 673 | txn, |
| 674 | workspace, |
| 675 | change_id, |
| 676 | insertion, |
| 677 | change, |
| 678 | verified_frontier, |
| 679 | detect_conflicts, |
| 680 | )?; |
| 681 | stats.atoms_processed += 1; |
| 682 | } |
| 683 | AtomRef::EdgeUpdate(edge_update) => { |
| 684 | write_edge_map_with_frontier( |
| 685 | txn, |
| 686 | workspace, |
| 687 | change_id, |
| 688 | edge_update, |
| 689 | change, |
| 690 | verified_frontier, |
| 691 | detect_conflicts, |
| 692 | )?; |
| 693 | stats.atoms_processed += 1; |
| 694 | } |
| 695 | AtomRef::Atom(atom) => match atom { |
| 696 | Atom::Insertion(nv) => { |
| 697 | write_new_vertex_with_frontier( |
| 698 | txn, |
| 699 | workspace, |
| 700 | change_id, |
| 701 | nv, |
| 702 | change, |
| 703 | verified_frontier, |
| 704 | detect_conflicts, |
| 705 | )?; |
| 706 | stats.atoms_processed += 1; |
| 707 | } |
no test coverage detected