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

Method record_with_lifecycle

atomic-repository/src/repository/record.rs:2014–4663  ·  view source on GitHub ↗
(
        &self,
        working_copy: WorkingCopyId,
        header: ChangeHeader,
        options: RecordOptions,
        lifecycle: super::snapshot::RecordLifecycle,
    )

Source from the content-addressed store, hash-verified

2012 }
2013
2014 pub(super) fn record_with_lifecycle(
2015 &self,
2016 working_copy: WorkingCopyId,
2017 header: ChangeHeader,
2018 options: RecordOptions,
2019 lifecycle: super::snapshot::RecordLifecycle,
2020 ) -> Result<RecordOutcome, RecordError> {
2021 self.validate_working_copy(working_copy)
2022 .map_err(RecordError::Repository)?;
2023 // Keep the selected view and the span baseline stable from status
2024 // through assembly and journaled publication. Nested record operations
2025 // on this thread reuse the workspace lock.
2026 let _span_lock = {
2027 use atomic_core::pristine::{CapabilityTxnT, SPAN_RANGE_CAPABILITY};
2028 let txn = self
2029 .pristine
2030 .read_txn()
2031 .map_err(|error| RecordError::Database(error.to_string()))?;
2032 let capability = txn
2033 .required_capability_version(SPAN_RANGE_CAPABILITY.id())
2034 .map_err(|error| RecordError::Database(error.to_string()))?;
2035 if capability == Some(2) {
2036 return Err(RecordError::Database(
2037 "span capability version 2 requires migration before recording".into(),
2038 ));
2039 }
2040 let enabled = capability.is_some();
2041 drop(txn);
2042 if enabled {
2043 Some(
2044 self.try_lock_workspace_operation(working_copy)
2045 .map_err(RecordError::Repository)?,
2046 )
2047 } else {
2048 None
2049 }
2050 };
2051 let desired_view = self
2052 .desired_view_name(working_copy)
2053 .map_err(RecordError::Repository)?;
2054 let effective_view = options
2055 .get_view()
2056 .map(str::to_owned)
2057 .unwrap_or_else(|| desired_view.clone());
2058 if effective_view != desired_view {
2059 return Err(RecordError::Repository(RepositoryError::InvalidOperation {
2060 message: format!(
2061 "record view '{}' does not match working copy {} desired view '{}'",
2062 effective_view, working_copy, desired_view
2063 ),
2064 }));
2065 }
2066
2067 let target_view = lifecycle.target_view(&desired_view).to_string();
2068
2069 // Scoped stale-conflict cleanup: when the caller explicitly names paths
2070 // and opts into conflict-marker content, reconcile persisted conflict
2071 // rows that no longer describe a real graph conflict. This runs before

Callers 4

snapshotMethod · 0.80
promote_snapshotMethod · 0.80
recordMethod · 0.80

Calls 15

RepositoryClass · 0.85
build_headerFunction · 0.85
graph_visibility_closureFunction · 0.85
plan_file_movesFunction · 0.85
filter_filesFunction · 0.85
conflict_cleanup_outcomeFunction · 0.85
working_inode_attrsFunction · 0.85
project_inode_attributesFunction · 0.85
ModeEnum · 0.85
KindEnum · 0.85
read_working_bytesFunction · 0.85