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