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

Function query_reindex

atomic-cli/src/commands/rpc.rs:7116–7142  ·  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

7114/// `atomic query reindex` over MaintainKnowledgeGraph (REINDEX) — the
7115/// handler runs vault_reindex_kg; the CLI prints the local report.
7116pub fn query_reindex(full: bool) -> CliResult<()> {
7117 let root = super::find_repository_root()?;
7118 let session = Service::open_root(&root)?.ok_or_else(|| CliError::InvalidArgument {
7119 message: "knowledge graph reindex requires a local repository service".into(),
7120 })?;
7121 let remote = match sync_resolve_remote(&session, &None) {
7122 Ok((_, url)) => Some(url),
7123 Err(CliError::RemoteNotFound { .. }) => None,
7124 Err(error) => return Err(error),
7125 };
7126 let signer_auth_headers = remote
7127 .as_deref()
7128 .map(|url| sync_auth_headers(url, None))
7129 .unwrap_or_default();
7130 let request = pb::MaintainKnowledgeGraphRequest {
7131 repository: Some(session.reference.clone()),
7132 meta: request_meta(),
7133 action: pb::KnowledgeMaintainAction::Reindex as i32,
7134 scope: full.then(|| "full".to_owned()),
7135 changes: Vec::new(),
7136 signer_auth_headers,
7137 signer_remote_url: remote,
7138 };
7139 let response = session.maintain_knowledge_graph(request)?;
7140 println!("Indexed {} nodes + edges.", response.processed);
7141 Ok(())
7142}
7143
7144/// Fetch the asserted graph through the same service for local and reactor
7145/// 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