MCPcopy Create free account
hub / github.com/base/base / write_metadata_atomically

Method write_metadata_atomically

etc/systems/src/benchmark_cli.rs:919–934  ·  view source on GitHub ↗
(output_dir: &Path, metadata: &VisualizerMetadata)

Source from the content-addressed store, hash-verified

917 }
918
919 fn write_metadata_atomically(output_dir: &Path, metadata: &VisualizerMetadata) -> Result<()> {
920 let destination = output_dir.join("metadata.json");
921 let temporary = output_dir.join(format!(".metadata.json.{}.tmp", std::process::id()));
922 fs::write(&temporary, serde_json::to_vec_pretty(metadata)?).wrap_err_with(|| {
923 format!("failed to write aggregate metadata temporary file {}", temporary.display())
924 })?;
925 fs::rename(&temporary, &destination).wrap_err_with(|| {
926 format!("failed to replace aggregate metadata {}", destination.display())
927 })?;
928 println!(
929 "aggregated {} selected benchmark run(s): {}",
930 metadata.runs.len(),
931 destination.display()
932 );
933 Ok(())
934 }
935}
936
937impl SnapshotBenchmarkArgs {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected