pub struct OpEvent {Show 15 fields
pub schema_version: String,
pub op_id: String,
pub parent_id: Option<String>,
pub session_id: String,
pub timestamp: DateTime<Utc>,
pub actor: Actor,
pub kind: OpKind,
pub payload: Value,
pub canonical_payload_hash: String,
pub preconditions: Option<Preconditions>,
pub dry_run_impact: Option<DryRunImpact>,
pub apply_result: Option<ApplyResult>,
pub prev_event_hash: Option<String>,
pub event_hash: Option<String>,
pub extra: BTreeMap<String, Value>,
}Expand description
Universal event envelope wrapping every effectful workbook operation.
Fields§
§schema_version: StringSchema version tag for forward-compatible parsing.
op_id: StringUnique event identifier (ULID-style sorted string).
parent_id: Option<String>Identifier of the previous event in this branch (forms a linked list).
session_id: StringSession this event belongs to.
timestamp: DateTime<Utc>Wall-clock timestamp of event creation.
actor: ActorWho or what created this event.
kind: OpKindNamespaced operation kind (e.g. structure.clone_row).
payload: ValueOperation-specific payload (JSON object).
canonical_payload_hash: StringSHA-256 hash over the canonicalized payload JSON.
preconditions: Option<Preconditions>Pre-apply validation constraints.
dry_run_impact: Option<DryRunImpact>Computed impact from dry-run staging (populated during stage, before apply).
apply_result: Option<ApplyResult>Result metadata after applying the event.
prev_event_hash: Option<String>Hash of the previous event record (for tamper-detection chains).
event_hash: Option<String>Hash of this entire event record (computed after serialization).
extra: BTreeMap<String, Value>Forward-compatible catch-all for unknown fields.
Implementations§
Source§impl OpEvent
impl OpEvent
Sourcepub fn new(
session_id: String,
parent_id: Option<String>,
actor: Actor,
kind: OpKind,
payload: Value,
) -> Self
pub fn new( session_id: String, parent_id: Option<String>, actor: Actor, kind: OpKind, payload: Value, ) -> Self
Create a new event with the given parameters and compute the payload hash.
Sourcepub fn with_preconditions(self, preconditions: Preconditions) -> Self
pub fn with_preconditions(self, preconditions: Preconditions) -> Self
Attach preconditions to this event.
Sourcepub fn with_dry_run_impact(self, impact: DryRunImpact) -> Self
pub fn with_dry_run_impact(self, impact: DryRunImpact) -> Self
Attach dry-run impact to this event.
Sourcepub fn with_apply_result(self, result: ApplyResult) -> Self
pub fn with_apply_result(self, result: ApplyResult) -> Self
Record the apply result.
Sourcepub fn validate_version(&self) -> Result<(), String>
pub fn validate_version(&self) -> Result<(), String>
Validate schema version compatibility.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for OpEvent
impl<'de> Deserialize<'de> for OpEvent
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>,
Auto Trait Implementations§
impl Freeze for OpEvent
impl RefUnwindSafe for OpEvent
impl Send for OpEvent
impl Sync for OpEvent
impl Unpin for OpEvent
impl UnsafeUnpin for OpEvent
impl UnwindSafe for OpEvent
Blanket Implementations§
impl<T> Allocation for T
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
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more