replay method

List<FreedomeEvent>? replay(
  1. Iterable<String> topics,
  2. int sinceSeq
)

Matching ring-buffer events after sinceSeq for topics, or null when the gap is too old.

Implementation

List<FreedomeEvent>? replay(Iterable<String> topics, int sinceSeq) {
  final oldest = bus.oldestSeq;
  if (sinceSeq > bus.seq) return null; // resume point from another epoch
  if (oldest != null && sinceSeq < oldest - 1) return null;
  if (oldest == null && sinceSeq < bus.seq) return null;
  return [
    for (final e in bus.history)
      if (e.seq > sinceSeq &&
          topics.any((f) => DomeTopics.matches(f, e.topic)) &&
          allowed(e.topic))
        e,
  ];
}