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

Function doctor_repair_native_indexes

atomic-cli/src/commands/rpc.rs:3209–3239  ·  view source on GitHub ↗

Native repair refuses unrepairable authority in a read-only handler preflight.

()

Source from the content-addressed store, hash-verified

3207
3208/// Native repair refuses unrepairable authority in a read-only handler preflight.
3209pub fn doctor_repair_native_indexes() -> CliResult<()> {
3210 let root = super::find_repository_root()?;
3211 let session = Service::open_root(&root)?.ok_or_else(|| CliError::InvalidArgument {
3212 message: "native-index repair requires a local repository service".into(),
3213 })?;
3214 print_info("Rebuilding native derived indexes from graph authority...");
3215 let outcome = session.repair(pb::RepairRequest {
3216 repository: Some(session.reference.clone()),
3217 meta: request_meta(),
3218 action: pb::RepairAction::RebuildNativeIndexes as i32,
3219 force: false,
3220 view: String::new(),
3221 })?;
3222 if outcome.native_already_healthy {
3223 print_success(&format!(
3224 "Native derived indexes are already consistent ({} rows).",
3225 outcome.native_rows_written
3226 ));
3227 } else {
3228 print_success(&format!(
3229 "Repaired {} native derived-index problem(s); wrote {} rows atomically{}.",
3230 outcome.native_problems_repaired,
3231 outcome.native_rows_written,
3232 outcome
3233 .native_operation
3234 .map(|operation| format!("; journaled as operation {operation}"))
3235 .unwrap_or_default()
3236 ));
3237 }
3238 Ok(())
3239}
3240
3241/// `atomic doctor check` over CheckRepository — the read-only consistency
3242/// check. Rendered to mirror the in-process path exactly (non-zero exit

Callers 1

runMethod · 0.85

Calls 6

find_repository_rootFunction · 0.85
print_infoFunction · 0.85
print_successFunction · 0.85
request_metaFunction · 0.70
repairMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected