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

Method scan_kv

nodedb/src/data/executor/scan_normalize.rs:53–74  ·  view source on GitHub ↗

Scan KV engine entries → standard msgpack. Injects the `key` field directly into the msgpack map — no JSON roundtrip.

(&self, tid: u64, collection: &str, limit: usize)

Source from the content-addressed store, hash-verified

51 /// Scan KV engine entries → standard msgpack.
52 /// Injects the `key` field directly into the msgpack map — no JSON roundtrip.
53 fn scan_kv(&self, tid: u64, collection: &str, limit: usize) -> Vec<(String, Vec<u8>)> {
54 let now_ms = crate::engine::kv::current_ms();
55 let (entries, _next_cursor) = self.kv_engine.scan(KvScanParams {
56 tenant_id: tid,
57 collection,
58 cursor: &[],
59 count: limit,
60 now_ms,
61 match_pattern: None,
62 filter_field: None,
63 filter_value: None,
64 surrogate_ceiling: None,
65 });
66 let mut results = Vec::with_capacity(entries.len());
67 for (key, value) in entries {
68 let key_str = String::from_utf8_lossy(&key).to_string();
69 // Inject "key" field into the msgpack map at binary level.
70 let mp = msgpack_scan::inject_str_field(&value, "key", &key_str);
71 results.push((key_str, mp));
72 }
73 results
74 }
75
76 /// Scan columnar rows → standard msgpack.
77 fn scan_columnar(&self, tid: u64, collection: &str, limit: usize) -> Vec<(String, Vec<u8>)> {

Callers 1

scan_collectionMethod · 0.80

Calls 6

inject_str_fieldFunction · 0.85
to_stringMethod · 0.80
current_msFunction · 0.50
scanMethod · 0.45
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected