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

Function write_recorded_in_txn

atomic-repository/src/repository/insert.rs:667–704  ·  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

665}
666
667fn 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
706fn validate_recorded_span_projection(
707 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