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

Method status

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

Source from the content-addressed store, hash-verified

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

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