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

Function doctor_repair_native_indexes

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

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

()

Source from the content-addressed store, hash-verified

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