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

Function query_reindex

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

`atomic query reindex` over MaintainKnowledgeGraph (REINDEX) — the handler runs vault_reindex_kg; the CLI prints the local report.

(full: bool)

Source from the content-addressed store, hash-verified

7074/// `atomic query reindex` over MaintainKnowledgeGraph (REINDEX) — the
7075/// handler runs vault_reindex_kg; the CLI prints the local report.
7076pub fn query_reindex(full: bool) -> CliResult<()> {
7077 let root = super::find_repository_root()?;
7078 let session = Service::open_root(&root)?.ok_or_else(|| CliError::InvalidArgument {
7079 message: "knowledge graph reindex requires a local repository service".into(),
7080 })?;
7081 let remote = match sync_resolve_remote(&session, &None) {
7082 Ok((_, url)) => Some(url),
7083 Err(CliError::RemoteNotFound { .. }) => None,
7084 Err(error) => return Err(error),
7085 };
7086 let signer_auth_headers = remote
7087 .as_deref()
7088 .map(|url| sync_auth_headers(url, None))
7089 .unwrap_or_default();
7090 let request = pb::MaintainKnowledgeGraphRequest {
7091 repository: Some(session.reference.clone()),
7092 meta: request_meta(),
7093 action: pb::KnowledgeMaintainAction::Reindex as i32,
7094 scope: full.then(|| "full".to_owned()),
7095 changes: Vec::new(),
7096 signer_auth_headers,
7097 signer_remote_url: remote,
7098 };
7099 let response = session.maintain_knowledge_graph(request)?;
7100 println!("Indexed {} nodes + edges.", response.processed);
7101 Ok(())
7102}
7103
7104/// Fetch the asserted graph through the same service for local and reactor
7105/// modes. The CLI adapts this immutable snapshot to RDF without opening redb.

Callers 1

runMethod · 0.85

Calls 6

find_repository_rootFunction · 0.85
sync_resolve_remoteFunction · 0.85
sync_auth_headersFunction · 0.85
request_metaFunction · 0.70
cloneMethod · 0.45

Tested by

no test coverage detected