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

Method prepare_checkpoint

atomic-cli/src/commands/agent/provenance_rpc.rs:674–714  ·  view source on GitHub ↗
(
        &self,
        reservation: JournalTurnReservation,
        source: JournalCheckpointSource,
        now: i64,
    )

Source from the content-addressed store, hash-verified

672 }
673
674 fn prepare_checkpoint(
675 &self,
676 reservation: JournalTurnReservation,
677 source: JournalCheckpointSource,
678 now: i64,
679 ) -> Result<JournalCheckpointAttempt, String> {
680 let reference = self.reference.clone();
681 // The legacy client computed reuse the same way: an empty change
682 // set with a recorded change means a previous Stop's journal read
683 // failed after the change was recorded.
684 let reuse_frozen_changes = source.change_hashes.is_empty();
685 let source = checkpoint_source_proto(&source);
686 let provenance_id = reservation.provenance_id;
687 run_outside_async_runtime(move || {
688 current_thread_runtime()?.block_on(async {
689 let response = request_with_reconnect("prepare checkpoint", |client| {
690 let reference = reference.clone();
691 let source = source.clone();
692 async move {
693 provenance_client(client)
694 .prepare_checkpoint(pb::PrepareCheckpointRequest {
695 repository: Some(reference),
696 meta: request_meta(now),
697 provenance_id,
698 expected_generation: reservation.generation,
699 source: Some(source),
700 reuse_frozen_changes,
701 })
702 .await
703 .map(|response| response.into_inner())
704 }
705 })
706 .await?;
707 let attempt = response
708 .attempt
709 .ok_or_else(|| anyhow!("prepare returned no attempt"))?;
710 Ok(journal_checkpoint_attempt(provenance_id, &attempt))
711 })
712 })
713 .map_err(|error: anyhow::Error| error.to_string())
714 }
715
716 fn load_frozen_envelopes(
717 &self,

Callers 1

runMethod · 0.45

Calls 10

current_thread_runtimeFunction · 0.85
request_with_reconnectFunction · 0.85
provenance_clientFunction · 0.85
checkpoint_source_protoFunction · 0.70
request_metaFunction · 0.70
cloneMethod · 0.45
is_emptyMethod · 0.45
into_innerMethod · 0.45

Tested by

no test coverage detected