MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / write_recorded_in_txn

Function write_recorded_in_txn

atomic-repository/src/repository/insert.rs:659–696  ·  view source on GitHub ↗
(
    repository: &Repository,
    txn: &mut atomic_core::pristine::WriteTxn<'_>,
    outcome: &RecordOutcome,
    view_name: &str,
)

Source from the content-addressed store, hash-verified

657}
658
659fn 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
698fn validate_recorded_span_projection(
699 repository: &Repository,

Callers 1

write_split_recordedMethod · 0.85

Calls 13

register_changeMethod · 0.80
put_change_depsMethod · 0.80
plan_tree_projectionMethod · 0.80
apply_prerequisitesMethod · 0.80
apply_tree_projectionMethod · 0.80
changeMethod · 0.45
hashMethod · 0.45
dependenciesMethod · 0.45
deleted_filesMethod · 0.45

Tested by

no test coverage detected