event method
Implementation
CommandApplyStatus event(CommandEvent event) {
if (_seenEventIds.contains(event.eventId)) {
return const CommandApplyDuplicate();
}
final entry = _entries[event.commandId];
if (entry == null) return const CommandApplyUnknown();
if (event.generation != entry.generation) {
return CommandApplyStaleGeneration(entry.generation, event.generation);
}
_seenEventIds.add(event.eventId);
var updated = entry.copyWith(lastEventId: event.eventId);
final next = _progressStatusOf(event.kind);
if (!updated.terminal &&
next != null &&
_phaseRank(next) >= _phaseRank(updated.status)) {
updated = updated.copyWith(status: next);
}
_entries[event.commandId] = updated;
return const CommandApplyRecorded();
}