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

Function stored_turn_proto

libatomic/src/daemon/services_query.rs:695–714  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

693/// Map a stored session turn to the wire shape (the fields the ledger owns:
694/// turn number, provenance hash, and the turn timestamp).
695fn 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)]
717mod timestamp_tests {

Calls 3

hash_protoFunction · 0.70
timestamp_datetimeMethod · 0.45
cloneMethod · 0.45