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

Function stored_turn_proto

libatomic/src/daemon/services_query.rs:692–711  ·  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

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

Calls 3

hash_protoFunction · 0.70
timestamp_datetimeMethod · 0.45
cloneMethod · 0.45