pub struct CommandJournalEntry {
pub command_id: CommandId,
pub account_id: AccountId,
pub idempotency_key: IdempotencyKey,
pub turn_id: TurnId,
pub case_ref: CaseRef,
pub command_type: String,
pub command_payload: Value,
pub origin: CommandOrigin,
pub status: CommandJournalStatus,
pub result: Option<JournalOutcome>,
pub created_at: DateTime<Utc>,
pub completed_at: Option<DateTime<Utc>>,
}Expand description
One row of the command journal (spec §22.2, tf_command_journal).
Fields§
§command_id: CommandIdThe command.
account_id: AccountIdOwning tenant.
idempotency_key: IdempotencyKeyIdempotency key, unique per account (I14).
turn_id: TurnIdTurn that produced the command.
case_ref: CaseRefTarget case and expected revision.
command_type: StringStable command type label (e.g. "trip.add_extra").
command_payload: ValueThe command payload as JSON.
origin: CommandOriginAuthorizing origin.
status: CommandJournalStatusCurrent status.
result: Option<JournalOutcome>Persisted outcome, once recorded.
created_at: DateTime<Utc>Admission time, supplied by the caller.
completed_at: Option<DateTime<Utc>>When the outcome was recorded, stamped by the store’s clock.
Implementations§
Source§impl CommandJournalEntry
impl CommandJournalEntry
Sourcepub fn from_envelope<C: Serialize>(
envelope: &CommandEnvelope<C>,
command_type: impl Into<String>,
created_at: DateTime<Utc>,
) -> Result<Self, StoreError>
pub fn from_envelope<C: Serialize>( envelope: &CommandEnvelope<C>, command_type: impl Into<String>, created_at: DateTime<Utc>, ) -> Result<Self, StoreError>
Builds a Pending entry from a typed envelope, serializing the command.
§Errors
Serializationwhen the command cannot be rendered as JSON.
Sourcepub fn same_command(&self, other: &Self) -> bool
pub fn same_command(&self, other: &Self) -> bool
Returns true when both entries describe the same command: same case
reference, type and payload. Used to detect an idempotency key reused
for a different command.
Trait Implementations§
Source§impl Clone for CommandJournalEntry
impl Clone for CommandJournalEntry
Source§impl Debug for CommandJournalEntry
impl Debug for CommandJournalEntry
Source§impl<'de> Deserialize<'de> for CommandJournalEntry
impl<'de> Deserialize<'de> for CommandJournalEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for CommandJournalEntry
Source§impl PartialEq for CommandJournalEntry
impl PartialEq for CommandJournalEntry
Source§impl Serialize for CommandJournalEntry
impl Serialize for CommandJournalEntry
impl StructuralPartialEq for CommandJournalEntry
Auto Trait Implementations§
impl Freeze for CommandJournalEntry
impl RefUnwindSafe for CommandJournalEntry
impl Send for CommandJournalEntry
impl Sync for CommandJournalEntry
impl Unpin for CommandJournalEntry
impl UnsafeUnpin for CommandJournalEntry
impl UnwindSafe for CommandJournalEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.