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

Method run

libatomic/src/daemon/services_review.rs:57–83  ·  view source on GitHub ↗
(
        &self,
        reference: Option<RepositoryRef>,
        method: &'static str,
        write: bool,
        action: impl FnOnce(&Repository) -> Result<T, Status> + Send + 'static,
    )

Source from the content-addressed store, hash-verified

55
56impl ReviewImpl {
57 async fn run<T: Send + 'static>(
58 &self,
59 reference: Option<RepositoryRef>,
60 method: &'static str,
61 write: bool,
62 action: impl FnOnce(&Repository) -> Result<T, Status> + Send + 'static,
63 ) -> Result<Response<T>, Status> {
64 let reference = reference
65 .ok_or_else(|| Status::invalid_argument("repository reference is required"))?;
66 let handle = self.state.resolve(&reference)?;
67 self.state.log_rpc(method, Some(&handle));
68 let guard = handle.exclusive_owned().await;
69 tokio::task::spawn_blocking(move || {
70 // A cancelled client cannot release repository exclusion while the
71 // blocking operation is still executing or materializing effects.
72 let _guard = guard;
73 let repo = if write {
74 handle.repository()?
75 } else {
76 handle.repository_readonly()?
77 };
78 action(&repo)
79 })
80 .await
81 .map_err(|error| Status::internal(error.to_string()))?
82 .map(Response::new)
83 }
84}
85
86#[tonic::async_trait]

Callers 10

run_checkerMethod · 0.45
generate_reviewMethod · 0.45
render_reviewMethod · 0.45
prepare_source_reviewMethod · 0.45
get_reviewMethod · 0.45
inspect_reviewsMethod · 0.45
open_reviewMethod · 0.45
approve_reviewMethod · 0.45
cancel_review_jobMethod · 0.45

Calls 5

log_rpcMethod · 0.80
exclusive_ownedMethod · 0.80
repositoryMethod · 0.80
repository_readonlyMethod · 0.80
resolveMethod · 0.45

Tested by 1

run_checkerMethod · 0.36