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

Method status

libatomic/src/daemon/services.rs:347–403  ·  view source on GitHub ↗
(
        &self,
        request: Request<StatusRequest>,
    )

Source from the content-addressed store, hash-verified

345#[tonic::async_trait]
346impl repository_query_service_server::RepositoryQueryService for QueryImpl {
347 async fn status(
348 &self,
349 request: Request<StatusRequest>,
350 ) -> Result<Response<StatusResponse>, Status> {
351 let request = request.into_inner();
352 let options = status_options_domain(request.options);
353 let handle = self
354 .state
355 .resolve(request.repository.as_ref().unwrap_or(&default_ref()))?;
356 self.state.log_rpc("Status", Some(&handle));
357 let gate_handle = handle.clone();
358 let _gate = gate_handle.exclusive().await;
359 let result = tokio::task::spawn_blocking(move || {
360 // Observe uses a read-only open with the read-concurrency wait and
361 // retains the working-copy boundary for the whole query. The CLI's
362 // separate Git coordinator performs ordinary reconciliation.
363 let (repo, workspace) =
364 handle.workspace_repository(atomic_repository::WorkspaceTxnMode::Observe)?;
365 let working_copy = workspace.working_copy();
366 // Compute exactly what the caller requested: the CLI sends its
367 // resolved StatusOptions on the wire (absent = domain defaults,
368 // which exclude ignored files — a fixed StatusOptions::all()
369 // used to leak node_modules/ and dist/ back as UNTRACKED, since
370 // the wire has no FILE_STATUS_IGNORED variant).
371 let status = repo
372 .status(working_copy, options)
373 .map_err(repository_error)?;
374 let files = status
375 .entries()
376 .iter()
377 .map(|entry| FileStatusEntry {
378 path: entry.path().display().to_string(),
379 status: file_status_proto(entry.status()) as i32,
380 inode: None,
381 recorded_hash: entry.recorded_hash().map(hash_proto),
382 current_hash: entry.current_hash().map(hash_proto),
383 details: super::convert::file_status_details(entry),
384 })
385 .collect();
386 Ok::<_, Status>(StatusResponse {
387 view: status.view().to_string(),
388 view_merkle: status.state().map(hash_proto),
389 needs_reindex: status.needs_reindex(),
390 files,
391 modified_count: status.modified_count() as u32,
392 deleted_count: status.deleted_count() as u32,
393 untracked_count: status.untracked_count() as u32,
394 added_count: status.added_count() as u32,
395 conflicted_count: status.conflicted_count() as u32,
396 stale_index_count: status.stale_index_count() as u32,
397 snapshot: None,
398 })
399 })
400 .await
401 .map_err(|error| Status::internal(format!("status task failed: {error}")))??;
402 Ok(Response::new(result))
403 }
404

Callers 4

preview_restoreMethod · 0.45
restoreMethod · 0.45
insert_changesMethod · 0.45

Calls 15

status_options_domainFunction · 0.85
default_refFunction · 0.85
file_status_protoFunction · 0.85
file_status_detailsFunction · 0.85
as_refMethod · 0.80
log_rpcMethod · 0.80
exclusiveMethod · 0.80
workspace_repositoryMethod · 0.80
entriesMethod · 0.80
displayMethod · 0.80
current_hashMethod · 0.80
needs_reindexMethod · 0.80

Tested by

no test coverage detected