Read events from a given LSN forward (for consumer polling). Returns shared `Arc ` handles so repeated polls by webhook and Kafka producers share the underlying allocation.
(&self, from_lsn: u64, limit: usize)
| 128 | /// Returns shared `Arc<CdcEvent>` handles so repeated polls by webhook |
| 129 | /// and Kafka producers share the underlying allocation. |
| 130 | pub fn read_from_lsn(&self, from_lsn: u64, limit: usize) -> Vec<Arc<CdcEvent>> { |
| 131 | let events = self.events.read().unwrap_or_else(|p| p.into_inner()); |
| 132 | events |
| 133 | .iter() |
| 134 | .filter(|e| e.lsn > from_lsn) |
| 135 | .take(limit) |
| 136 | .cloned() |
| 137 | .collect() |
| 138 | } |
| 139 | |
| 140 | /// Read events from a specific partition, starting after `from_lsn`. |
| 141 | /// Partition = vShard ID. Scans the buffer and filters by partition. |