pub struct Operation {
pub parent_ids: Vec<GitOid>,
pub workspace_id: WorkspaceId,
pub timestamp: String,
pub payload: OpPayload,
}Expand description
A single operation in a workspace’s op log (§5.3).
Operations form a chain: each operation points to its parent(s) by git OID. For single-workspace operations there is one parent; merge operations may have multiple parents (one per source workspace).
The entire struct serializes to canonical JSON, which is then stored as a git blob. The blob’s OID becomes the operation’s identity.
Fields§
§parent_ids: Vec<GitOid>OIDs of parent operations (empty for the first op in a workspace).
workspace_id: WorkspaceIdThe workspace that performed this operation.
timestamp: StringISO 8601 timestamp (UTC) of when the operation was created.
Stored as a string for canonical JSON (avoids platform-specific floating-point or integer timestamp representations).
payload: OpPayloadThe mutation that this operation represents.
Implementations§
Source§impl Operation
impl Operation
Sourcepub fn to_canonical_json(&self) -> Result<Vec<u8>, Error>
pub fn to_canonical_json(&self) -> Result<Vec<u8>, Error>
Serialize this operation to canonical JSON bytes.
Canonical JSON: sorted keys, no trailing whitespace, deterministic.
Two calls with the same Operation always produce identical bytes.
§Errors
Returns an error if serialization fails (shouldn’t happen for valid ops).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Operation
impl<'de> Deserialize<'de> for Operation
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>,
impl Eq for Operation
impl StructuralPartialEq for Operation
Auto Trait Implementations§
impl Freeze for Operation
impl RefUnwindSafe for Operation
impl Send for Operation
impl Sync for Operation
impl Unpin for Operation
impl UnsafeUnpin for Operation
impl UnwindSafe for Operation
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
key and return true if they are equal.