Map a stored session turn to the wire shape (the fields the ledger owns: turn number, provenance hash, and the turn timestamp).
(turn: atomic_core::change::session::SessionTurn)
| 693 | /// Map a stored session turn to the wire shape (the fields the ledger owns: |
| 694 | /// turn number, provenance hash, and the turn timestamp). |
| 695 | fn stored_turn_proto(turn: atomic_core::change::session::SessionTurn) -> StoredProvenanceTurn { |
| 696 | let created_at = turn |
| 697 | .timestamp_datetime() |
| 698 | .map(super::convert::timestamp_proto); |
| 699 | StoredProvenanceTurn { |
| 700 | schema_version: 1, |
| 701 | provenance_id: 0, |
| 702 | session_id: turn.session_id.clone(), |
| 703 | turn_number: turn.turn_number, |
| 704 | state: ProvenanceTurnState::Unspecified as i32, |
| 705 | generation: 0, |
| 706 | next_event_seq: 0, |
| 707 | created_at, |
| 708 | updated_at: None, |
| 709 | completed_at: None, |
| 710 | final_hash: Some(hash_proto(&turn.provenance_hash)), |
| 711 | checkpoint_attempt: None, |
| 712 | stop_state: None, |
| 713 | } |
| 714 | } |
| 715 | |
| 716 | #[cfg(test)] |
| 717 | mod timestamp_tests { |