Like [`scan`], but surfaces each row's surrogate alongside its key/value so a caller can filter by clone snapshot-isolation ceiling (drop rows bound after the AS-OF point).
(
&self,
cursor_idx: usize,
count: usize,
now_ms: u64,
match_pattern: Option<&str>,
)
| 57 | /// key/value so a caller can filter by clone snapshot-isolation |
| 58 | /// ceiling (drop rows bound after the AS-OF point). |
| 59 | pub fn scan_with_surrogate( |
| 60 | &self, |
| 61 | cursor_idx: usize, |
| 62 | count: usize, |
| 63 | now_ms: u64, |
| 64 | match_pattern: Option<&str>, |
| 65 | ) -> ScanBatchWithSurrogate<'_> { |
| 66 | let mut results = Vec::with_capacity(count); |
| 67 | let total_slots = self.capacity() + self.rehash_source_len(); |
| 68 | |
| 69 | let mut idx = cursor_idx; |
| 70 | while results.len() < count && idx < total_slots { |
| 71 | let entry = self.slot_at(idx); |
| 72 | |
| 73 | if let Some(e) = entry |
| 74 | && !e.is_expired(now_ms) |
| 75 | && matches_pattern(&e.key, match_pattern) |
| 76 | { |
| 77 | let value = self.read_value(e); |
| 78 | results.push((e.key.as_slice(), value, e.surrogate)); |
| 79 | } |
| 80 | idx += 1; |
| 81 | } |
| 82 | |
| 83 | let next_cursor = if idx >= total_slots { 0 } else { idx }; |
| 84 | (results, next_cursor) |
| 85 | } |
| 86 | |
| 87 | /// Access a slot by unified index (primary first, then rehash source). |
| 88 | fn slot_at(&self, idx: usize) -> Option<&KvEntry> { |
no test coverage detected