pub struct WorkItemState {Show 15 fields
pub title: LwwRegister<String>,
pub description: LwwRegister<String>,
pub kind: LwwRegister<Kind>,
pub state: EpochPhaseState,
pub size: LwwRegister<Option<Size>>,
pub urgency: LwwRegister<Urgency>,
pub parent: LwwRegister<String>,
pub assignees: OrSet<String>,
pub labels: OrSet<String>,
pub blocked_by: OrSet<String>,
pub related_to: OrSet<String>,
pub comments: GSet<String>,
pub deleted: LwwRegister<bool>,
pub created_at: u64,
pub updated_at: u64,
}Expand description
Composite CRDT representing the full state of a work item.
All fields are individually mergeable CRDTs. The aggregate merge delegates to each field, preserving semilattice laws.
Fields§
§title: LwwRegister<String>Item title (LWW register).
description: LwwRegister<String>Item description (LWW register, empty string = no description).
kind: LwwRegister<Kind>Work item kind (LWW register).
state: EpochPhaseStateLifecycle state (epoch+phase CRDT).
size: LwwRegister<Option<Size>>T-shirt size estimate (LWW register, None encoded as Size::M default).
urgency: LwwRegister<Urgency>Priority/urgency override (LWW register).
parent: LwwRegister<String>Parent item ID (LWW register, empty string = no parent).
assignees: OrSet<String>Assigned agents (OR-Set, add-wins).
labels: OrSet<String>Labels (OR-Set, add-wins).
blocked_by: OrSet<String>Blocked-by item IDs (OR-Set, add-wins).
Related-to item IDs (OR-Set, add-wins).
comments: GSet<String>Comment event hashes (G-Set, grow-only).
deleted: LwwRegister<bool>Soft-delete flag (LWW register).
created_at: u64Wall-clock timestamp of the earliest event (for created_at).
updated_at: u64Wall-clock timestamp of the latest applied event (for updated_at).
Implementations§
Source§impl WorkItemState
impl WorkItemState
Sourcepub fn to_snapshot_payload(
&self,
item_id: &str,
compacted_from: usize,
earliest_ts: i64,
latest_ts: i64,
) -> SnapshotPayload
pub fn to_snapshot_payload( &self, item_id: &str, compacted_from: usize, earliest_ts: i64, latest_ts: i64, ) -> SnapshotPayload
Serialize the full CRDT aggregate to a SnapshotPayload.
This captures per-field clock metadata needed for correct lattice merge when the snapshot is applied on another replica.
Sourcepub fn from_snapshot_payload(payload: &SnapshotPayload) -> Self
pub fn from_snapshot_payload(payload: &SnapshotPayload) -> Self
Reconstruct a WorkItemState from a SnapshotPayload.
The resulting state can be merged with other states via the normal
WorkItemState::merge — this is how snapshots participate in the
lattice.
Source§impl WorkItemState
impl WorkItemState
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new empty WorkItemState with default values.
All LWW registers start with a zero stamp (epoch 0, no identity). All sets start empty. State starts at epoch 0, phase Open.
Sourcepub fn merge(&mut self, other: &WorkItemState)
pub fn merge(&mut self, other: &WorkItemState)
Merge another WorkItemState into this one.
Each field delegates to its own CRDT merge. The aggregate merge preserves semilattice properties because the product of semilattices is a semilattice.
Sourcepub fn apply_event(&mut self, event: &Event)
pub fn apply_event(&mut self, event: &Event)
Apply an event to this aggregate, updating the appropriate field CRDT.
The event’s metadata (wall_ts, agent, event_hash) is used to construct the LWW timestamp or OR-Set tag for the update.
Unknown event types and unrecognized update fields are silently ignored (no-op), following the principle that invalid events are skipped during replay.
Sourcepub const fn is_deleted(&self) -> bool
pub const fn is_deleted(&self) -> bool
Check if this item is soft-deleted.
Sourcepub fn assignee_names(&self) -> HashSet<&String>
pub fn assignee_names(&self) -> HashSet<&String>
Return the set of current assignee names.
Sourcepub fn label_names(&self) -> HashSet<&String>
pub fn label_names(&self) -> HashSet<&String>
Return the set of current label strings.
Sourcepub fn blocked_by_ids(&self) -> HashSet<&String>
pub fn blocked_by_ids(&self) -> HashSet<&String>
Return the set of items blocking this one.
Return the set of related item IDs.
Sourcepub const fn comment_hashes(&self) -> &HashSet<String>
pub const fn comment_hashes(&self) -> &HashSet<String>
Return comment event hashes.
Trait Implementations§
Source§impl Clone for WorkItemState
impl Clone for WorkItemState
Source§fn clone(&self) -> WorkItemState
fn clone(&self) -> WorkItemState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more