(
repository: &Repository,
txn: &mut atomic_core::pristine::WriteTxn<'_>,
outcome: &RecordOutcome,
view_name: &str,
)
| 657 | } |
| 658 | |
| 659 | fn write_recorded_in_txn( |
| 660 | repository: &Repository, |
| 661 | txn: &mut atomic_core::pristine::WriteTxn<'_>, |
| 662 | outcome: &RecordOutcome, |
| 663 | view_name: &str, |
| 664 | ) -> Result<InsertOutcome, RepositoryError> { |
| 665 | let change = outcome.change(); |
| 666 | let hash = outcome.hash(); |
| 667 | repository.ensure_change_allowed_in_view(txn, view_name, change)?; |
| 668 | let change_id = txn |
| 669 | .register_change(hash) |
| 670 | .map_err(|error| RepositoryError::Database(error.to_string()))?; |
| 671 | txn.put_change_deps(change_id, change.dependencies()) |
| 672 | .map_err(|error| RepositoryError::Database(error.to_string()))?; |
| 673 | let preserve_existing_tree_paths = view_name != repository.current_view; |
| 674 | let tree_projection = repository.plan_tree_projection( |
| 675 | txn, |
| 676 | change_id, |
| 677 | *hash, |
| 678 | change, |
| 679 | outcome.deleted_files(), |
| 680 | preserve_existing_tree_paths, |
| 681 | )?; |
| 682 | tree_projection.apply_prerequisites(txn)?; |
| 683 | let mut options = InsertOptions::default().view(view_name); |
| 684 | options.track_conflicts = false; |
| 685 | let inserted = write_recorded_graph_and_spans( |
| 686 | repository, txn, view_name, change_id, hash, change, &options, |
| 687 | )?; |
| 688 | validate_recorded_span_projection(repository, txn, view_name, *hash, change)?; |
| 689 | repository.apply_tree_projection( |
| 690 | txn, |
| 691 | &tree_projection, |
| 692 | view_name, |
| 693 | preserve_existing_tree_paths, |
| 694 | )?; |
| 695 | Ok(inserted) |
| 696 | } |
| 697 | |
| 698 | fn validate_recorded_span_projection( |
| 699 | repository: &Repository, |
no test coverage detected