Query recent changes for a collection since a given timestamp. Returns change events matching the collection filter that occurred at or after `since_ms` (epoch milliseconds). Limited to the ring buffer capacity (most recent N events).
(
&self,
collection: Option<&str>,
since_ms: u64,
limit: usize,
)
| 248 | /// at or after `since_ms` (epoch milliseconds). Limited to the ring |
| 249 | /// buffer capacity (most recent N events). |
| 250 | pub fn query_changes( |
| 251 | &self, |
| 252 | collection: Option<&str>, |
| 253 | since_ms: u64, |
| 254 | limit: usize, |
| 255 | ) -> Vec<ChangeEvent> { |
| 256 | let buf = match self.recent_changes.read() { |
| 257 | Ok(b) => b, |
| 258 | Err(p) => p.into_inner(), |
| 259 | }; |
| 260 | buf.iter() |
| 261 | .filter(|e| e.timestamp_ms >= since_ms && collection.is_none_or(|c| e.collection == c)) |
| 262 | .take(limit) |
| 263 | .cloned() |
| 264 | .collect() |
| 265 | } |
| 266 | |
| 267 | /// Manually decrement the active subscription counter. |
| 268 | /// |