(turn: &StoreTurn)
| 167 | } |
| 168 | |
| 169 | fn 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 | |
| 195 | fn stop_state_proto(stop: &StopState) -> PbStopState { |
| 196 | PbStopState { |
no test coverage detected