MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / read_from_lsn

Method read_from_lsn

nodedb/src/event/cdc/buffer.rs:130–138  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Calls 4

collectMethod · 0.80
readMethod · 0.45
takeMethod · 0.45
iterMethod · 0.45