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

Function run

atomic-repository/examples/imported_materialize_bench.rs:84–291  ·  view source on GitHub ↗
(
    repo_path: &Path,
    manifest_path: &Path,
    output: &Path,
    backend: &str,
    case: &str,
    allow_debug: bool,
)

Source from the content-addressed store, hash-verified

82}
83
84fn run(
85 repo_path: &Path,
86 manifest_path: &Path,
87 output: &Path,
88 backend: &str,
89 case: &str,
90 allow_debug: bool,
91) -> Result<()> {
92 ensure!(matches!(backend, "graph" | "span"), "invalid backend");
93 ensure!(
94 matches!(case, "render" | "materialize_missing"),
95 "invalid case"
96 );
97 ensure!(
98 !cfg!(debug_assertions) || allow_debug,
99 "use a release build"
100 );
101 ensure!(!output.exists(), "refusing to overwrite report");
102 let manifest: Manifest = serde_json::from_slice(&fs::read(manifest_path)?)?;
103 ensure!(!manifest.files.is_empty(), "empty fixture");
104 let mut names = std::collections::HashSet::new();
105 for file in &manifest.files {
106 ensure!(
107 !file.path.is_empty()
108 && Path::new(&file.path)
109 .components()
110 .all(|part| matches!(part, Component::Normal(_))),
111 "unsafe path"
112 );
113 ensure!(names.insert(file.path.clone()), "duplicate path");
114 ensure!(
115 matches!(file.mode.as_str(), "100644" | "100755" | "120000"),
116 "unsupported Git mode"
117 );
118 }
119 let mut report = Report {
120 schema: 1,
121 git_tip: manifest.git_tip.clone(),
122 backend: backend.into(),
123 case: case.into(),
124 debug_build: cfg!(debug_assertions),
125 total_ns: 0,
126 phases_ns: BTreeMap::new(),
127 span_context_phases_ns: BTreeMap::new(),
128 span_context_counts: BTreeMap::new(),
129 verified_files: manifest.files.len(),
130 rendered_bytes: 0,
131 files_written: None,
132 files_skipped: None,
133 bytes_written: None,
134 head_verified: false,
135 };
136 let mut rendered = Vec::new();
137 let started = Instant::now();
138 let phase = Instant::now();
139 let repo = Repository::open(repo_path)?;
140 let wc = repo.require_working_copy_id()?;
141 report

Callers 2

mainFunction · 0.70

Calls 15

openFunction · 0.85
verify_filesFunction · 0.85
WorkingCopyInterface · 0.85
read_txnMethod · 0.80
pristineMethod · 0.80
desired_view_nameMethod · 0.80
view_membership_setMethod · 0.80
build_metricsMethod · 0.80
operation_logMethod · 0.80
readFunction · 0.50