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

Method bind_checkpoint_hash

atomic-cli/src/commands/agent/provenance_rpc.rs:768–811  ·  view source on GitHub ↗
(
        &self,
        checkpoint: &JournalCheckpointAttempt,
        hash: Hash,
        session_turn: SessionTurn,
        now: i64,
    )

Source from the content-addressed store, hash-verified

766 }
767
768 fn bind_checkpoint_hash(
769 &self,
770 checkpoint: &JournalCheckpointAttempt,
771 hash: Hash,
772 session_turn: SessionTurn,
773 now: i64,
774 ) -> Result<JournalCheckpointAttempt, String> {
775 let reference = self.reference.clone();
776 let provenance_id = checkpoint.provenance_id;
777 let expected_generation = checkpoint.attempt_generation;
778 let hash = hash_proto(&hash);
779 let wire_turn = pb::SessionTurn {
780 session_id: session_turn.session_id.clone(),
781 turn_number: session_turn.turn_number,
782 };
783 run_outside_async_runtime(move || {
784 current_thread_runtime()?.block_on(async {
785 let response = request_with_reconnect("bind checkpoint hash", |client| {
786 let reference = reference.clone();
787 let hash = hash.clone();
788 let wire_turn = wire_turn.clone();
789 async move {
790 provenance_client(client)
791 .bind_checkpoint_hash(pb::BindCheckpointHashRequest {
792 repository: Some(reference),
793 meta: request_meta(now),
794 provenance_id,
795 expected_generation,
796 hash: Some(hash),
797 session_turn: Some(wire_turn),
798 })
799 .await
800 .map(|response| response.into_inner())
801 }
802 })
803 .await?;
804 let attempt = response
805 .attempt
806 .ok_or_else(|| anyhow!("bind returned no attempt"))?;
807 Ok(journal_checkpoint_attempt(provenance_id, &attempt))
808 })
809 })
810 .map_err(|error: anyhow::Error| error.to_string())
811 }
812
813 fn acknowledge_checkpoint(
814 &self,

Callers 1

runMethod · 0.45

Calls 9

current_thread_runtimeFunction · 0.85
request_with_reconnectFunction · 0.85
provenance_clientFunction · 0.85
hash_protoFunction · 0.70
request_metaFunction · 0.70
cloneMethod · 0.45
into_innerMethod · 0.45

Tested by

no test coverage detected