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

Function fetch_identity

libatomic/src/identity_transport.rs:98–114  ·  view source on GitHub ↗

Fetch-only half of [`reconcile_after_fetch`], for transports that must keep repository writes off the async context (the daemon runs them inside `spawn_blocking`). `None` = nothing to adopt.

(
    remote: &HttpRemote,
)

Source from the content-addressed store, hash-verified

96/// repository writes off the async context (the daemon runs them inside
97/// `spawn_blocking`). `None` = nothing to adopt.
98pub async fn fetch_identity(
99 remote: &HttpRemote,
100) -> Result<Option<serde_json::Value>, RepositoryError> {
101 let fetched = match remote.fetch_project_identity().await {
102 Ok(fetched) => fetched,
103 // Transport trouble is not a fetch failure: identity adoption is
104 // additive and must never fail the pull that just succeeded.
105 Err(error) => {
106 tracing::info!("project-identity fetch skipped: {error}");
107 return Ok(None);
108 }
109 };
110 match fetched {
111 IdentityFetch::Bound(document) => Ok(Some(document)),
112 IdentityFetch::Unbound | IdentityFetch::Unsupported => Ok(None),
113 }
114}
115
116/// Repo-write half of [`reconcile_after_fetch`]: apply a fetched identity
117/// document to the local repository. Skip entirely when nothing was fetched.

Callers 3

reconcile_after_fetchFunction · 0.85
adopt_from_remoteFunction · 0.85
pull_changes_implFunction · 0.85

Calls 1

Tested by

no test coverage detected