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

Method fork_session

libatomic/src/daemon/services_agent.rs:4774–4805  ·  view source on GitHub ↗
(
        &self,
        request: Request<ForkSessionRequest>,
    )

Source from the content-addressed store, hash-verified

4772 }
4773
4774 async fn fork_session(
4775 &self,
4776 request: Request<ForkSessionRequest>,
4777 ) -> Result<Response<ForkSessionResponse>, Status> {
4778 // `atomic session fork` — the domain fork (parent manifest, child
4779 // session, the inherited turns) runs handler-side; the wire carries
4780 // both manifest hashes for the local fork report.
4781 let request = request.into_inner();
4782 let handle = self.state.resolve(request.repository.as_ref().unwrap())?;
4783 self.state.log_rpc("ForkSession", Some(&handle));
4784 let gate_handle = handle.clone();
4785 let _gate = gate_handle.exclusive().await;
4786 let meta = request.meta.clone();
4787 let session_id = request.session_id.clone();
4788 let child = request.forked_session_id.clone();
4789 let child_for_report = child.clone();
4790 let at_turn = request.at_turn.unwrap_or(0);
4791 let (parent_hash, child_hash) = tokio::task::spawn_blocking(move || {
4792 let repo = handle.repository()?;
4793 repo.fork_session(&session_id, at_turn, &child)
4794 .map_err(repository_error)
4795 })
4796 .await
4797 .map_err(|e| Status::internal(e.to_string()))??;
4798 Ok(Response::new(ForkSessionResponse {
4799 session_id: child_for_report,
4800 parent_manifest: Some(super::convert::hash_proto(&parent_hash)),
4801 child_manifest: Some(super::convert::hash_proto(&child_hash)),
4802 fork_turn: Some(at_turn),
4803 meta: response_meta(&meta),
4804 }))
4805 }
4806
4807 async fn rebuild_session_index(
4808 &self,

Callers

nothing calls this directly

Calls 10

response_metaFunction · 0.85
as_refMethod · 0.80
log_rpcMethod · 0.80
exclusiveMethod · 0.80
repositoryMethod · 0.80
hash_protoFunction · 0.70
into_innerMethod · 0.45
resolveMethod · 0.45
unwrapMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected