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

Method read_partition_from_lsn

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

Read events from a specific partition, starting after `from_lsn`. Partition = vShard ID. Scans the buffer and filters by partition.

(
        &self,
        partition_id: u32,
        from_lsn: u64,
        limit: usize,
    )

Source from the content-addressed store, hash-verified

140 /// Read events from a specific partition, starting after `from_lsn`.
141 /// Partition = vShard ID. Scans the buffer and filters by partition.
142 pub fn read_partition_from_lsn(
143 &self,
144 partition_id: u32,
145 from_lsn: u64,
146 limit: usize,
147 ) -> Vec<Arc<CdcEvent>> {
148 let events = self.events.read().unwrap_or_else(|p| p.into_inner());
149 events
150 .iter()
151 .filter(|e| e.partition == partition_id && e.lsn > from_lsn)
152 .take(limit)
153 .cloned()
154 .collect()
155 }
156
157 /// Compact the buffer: deduplicate by key field, keeping only the latest
158 /// event per key value. DELETE events are retained as tombstones until

Callers 3

consume_localFunction · 0.80

Calls 4

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