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

Method scan

nodedb/src/engine/kv/scan.rs:45–54  ·  view source on GitHub ↗

Cursor-based scan: iterate entries starting from `cursor_idx`. Returns `(entries, next_cursor)`. `entries` contains up to `count` non-expired `(key, value)` pairs. `next_cursor` is `0` if the scan is complete, otherwise the next slot index to resume from. Scans the primary table first, then the rehash source (if active). Optionally filters keys by a glob-like prefix pattern.

(
        &self,
        cursor_idx: usize,
        count: usize,
        now_ms: u64,
        match_pattern: Option<&str>,
    )

Source from the content-addressed store, hash-verified

43 /// Scans the primary table first, then the rehash source (if active).
44 /// Optionally filters keys by a glob-like prefix pattern.
45 pub fn scan(
46 &self,
47 cursor_idx: usize,
48 count: usize,
49 now_ms: u64,
50 match_pattern: Option<&str>,
51 ) -> ScanBatch<'_> {
52 let (rows, next) = self.scan_with_surrogate(cursor_idx, count, now_ms, match_pattern);
53 (rows.into_iter().map(|(k, v, _)| (k, v)).collect(), next)
54 }
55
56 /// Like [`scan`], but surfaces each row's surrogate alongside its
57 /// key/value so a caller can filter by clone snapshot-isolation

Callers 9

dispatchFunction · 0.45
scan_kvMethod · 0.45
execute_kv_scanMethod · 0.45
register_sorted_indexMethod · 0.45
scan_basicFunction · 0.45
scan_with_count_limitFunction · 0.45
scan_skips_expiredFunction · 0.45
register_indexMethod · 0.45

Calls 2

scan_with_surrogateMethod · 0.80
collectMethod · 0.80

Tested by 3

scan_basicFunction · 0.36
scan_with_count_limitFunction · 0.36
scan_skips_expiredFunction · 0.36