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

Method write_import_recorded

atomic-repository/src/repository/insert.rs:1503–1632  ·  view source on GitHub ↗
(
        &self,
        header: ChangeHeader,
        recorded_files: &[atomic_core::record::workflow::RecordedFile],
        unhashed: serde_json::Value,
        deleted_paths: &[String],
        pr

Source from the content-addressed store, hash-verified

1501 /// view's global TREE mappings.
1502 #[allow(clippy::too_many_arguments)]
1503 pub fn write_import_recorded(
1504 &self,
1505 header: ChangeHeader,
1506 recorded_files: &[atomic_core::record::workflow::RecordedFile],
1507 unhashed: serde_json::Value,
1508 deleted_paths: &[String],
1509 preserve_existing_tree_paths: bool,
1510 _verified: &VerifiedProspectiveEquivalence,
1511 options: InsertOptions,
1512 ) -> Result<ImportWriteOutcome, RepositoryError> {
1513 use atomic_core::record::workflow::assemble_change;
1514 use atomic_core::record::workflow::assembly::AssemblyOptions;
1515
1516 let mut timings = ImportWriteTimings::default();
1517 let view_name = options.view.as_deref().unwrap_or(&self.current_view);
1518 self.pristine
1519 .require_repository_capability(CHANGE_FORMAT_VNEXT_CAPABILITY)
1520 .map_err(RepositoryError::from)?;
1521
1522 let mut txn = self
1523 .pristine
1524 .write_txn()
1525 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1526
1527 let assemble_start = std::time::Instant::now();
1528 let mut change = if recorded_files.is_empty() {
1529 Change::empty(header)
1530 } else {
1531 let view = txn
1532 .get_view(view_name)
1533 .map_err(|e| RepositoryError::Database(e.to_string()))?
1534 .ok_or_else(|| RepositoryError::ViewNotFound {
1535 name: view_name.to_string(),
1536 })?;
1537 let visibility = graph_visibility_closure(&txn, &view)?;
1538 let view_graph = atomic_core::pristine::ViewGraph::new(&txn, visibility);
1539 match assemble_change(
1540 &view_graph,
1541 recorded_files,
1542 header.clone(),
1543 &AssemblyOptions::default(),
1544 ) {
1545 Ok(result) => result.into_change(),
1546 Err(e) => {
1547 let err_msg = e.to_string();
1548 if err_msg.contains("empty") || err_msg.contains("AllEmpty") {
1549 Change::empty(header)
1550 } else {
1551 return Err(RepositoryError::Apply(e.to_string()));
1552 }
1553 }
1554 }
1555 };
1556 timings.assemble_ms = assemble_start.elapsed().as_millis();
1557 validate_import_deleted_paths(&change, deleted_paths)?;
1558
1559 change.unhashed = Some(unhashed);
1560

Calls 15

graph_visibility_closureFunction · 0.85
assemble_changeFunction · 0.85
import_direct_can_applyFunction · 0.85
write_change_to_graphFunction · 0.85
write_txnMethod · 0.80
register_changeMethod · 0.80
put_change_depsMethod · 0.80
plan_tree_projectionMethod · 0.80
apply_prerequisitesMethod · 0.80