pub fn compact_item<S: BuildHasher>(
item_id: &str,
events: &[Event],
agent: &str,
redacted_hashes: &HashSet<String, S>,
) -> Option<Event>Expand description
Compact all events for a single item into one item.snapshot event.
Replays events to produce final CRDT state, then creates a single
snapshot event encoding the full WorkItemState with per-field clocks.
§Arguments
item_id— The work item identifier.events— All events for this item, in causal/chronological order.agent— Agent identifier for the snapshot event.redacted_hashes— Set of event hashes that have been redacted. If any source events are redacted, the compaction is skipped (returns None).
§Returns
Some(Event) with the snapshot, or None if the item has redacted events
(compaction must not reintroduce redacted content).
§Panics
Panics if the SnapshotPayload cannot be serialized to JSON. This should
never happen with valid CRDT state.