pub struct PreparedEntry { /* private fields */ }Expand description
One entry a turn task proposes to the actor, already serialized and
masked (commit-protocol.md §Proposal payloads): the actor’s disk-write
path (hotl_store::SessionLog::append_prepared) never touches
EntryPayload again. item carries the typed value for entries that
also live in the model-visible projection — the actor still needs it to
update SessionCmd::Snapshot’s answer, and keeping it here is not a
second serialization: it is the exact value the turn already built in
memory to produce payload, never re-parsed from payload’s bytes
(that would just move T3-16’s per-entry cost back onto the actor rather
than delete it). None for entries that never enter the projection
(Usage, PendingAsk/AskResolved).
Fields are private: payload and item are two independently-built
views of the same logical entry, and nothing about the types alone
guarantees they agree. PreparedEntry::new is the only constructor —
it debug-asserts that item’s presence matches payload.kind(), so a
future call site that passes a mismatched pair (wrong variable, copied
from a different entry) fails loudly in tests/dev builds instead of
silently diverging the projection from the log.
Implementations§
Source§impl PreparedEntry
impl PreparedEntry
pub fn new(payload: PreparedPayload, item: Option<Item>) -> Self
pub fn payload(&self) -> &PreparedPayload
pub fn item(&self) -> Option<&Item>
Sourcepub fn into_parts(self) -> (PreparedPayload, Option<Item>)
pub fn into_parts(self) -> (PreparedPayload, Option<Item>)
Consume the entry: the actor’s commit loop needs to move payload
into SessionLog::append_prepared and, separately, item (if any)
into the live projection.