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

Method write_import_recorded

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

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

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