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

Function stored_turn_proto

libatomic/src/daemon/services_provenance.rs:169–193  ·  view source on GitHub ↗
(turn: &StoreTurn)

Source from the content-addressed store, hash-verified

167}
168
169fn stored_turn_proto(turn: &StoreTurn) -> StoredProvenanceTurn {
170 use crate::atomic::ProvenanceTurnState as PbState;
171 let (state, stop_state) = match &turn.state {
172 ProvenanceTurnState::Running => (PbState::Running, None),
173 ProvenanceTurnState::Stopped(stop) => (PbState::Stopped, Some(stop_state_proto(stop))),
174 ProvenanceTurnState::Checkpointing => (PbState::Checkpointing, None),
175 ProvenanceTurnState::Completed => (PbState::Completed, None),
176 ProvenanceTurnState::Abandoned(stop) => (PbState::Abandoned, Some(stop_state_proto(stop))),
177 };
178 StoredProvenanceTurn {
179 schema_version: turn.schema_version as u32,
180 provenance_id: turn.provenance_id.get(),
181 session_id: turn.session_id.clone(),
182 turn_number: turn.turn_number,
183 state: state as i32,
184 generation: turn.generation,
185 next_event_seq: turn.next_event_seq,
186 created_at: Some(timestamp(turn.created_at)),
187 updated_at: Some(timestamp(turn.updated_at)),
188 completed_at: turn.completed_at.map(timestamp),
189 final_hash: turn.final_hash.as_ref().map(hash_proto),
190 checkpoint_attempt: turn.checkpoint_attempt.as_ref().map(attempt_proto),
191 stop_state,
192 }
193}
194
195fn stop_state_proto(stop: &StopState) -> PbStopState {
196 PbStopState {

Callers 1

reserve_turn_implFunction · 0.70

Calls 5

stop_state_protoFunction · 0.85
as_refMethod · 0.80
timestampFunction · 0.70
getMethod · 0.65
cloneMethod · 0.45

Tested by

no test coverage detected