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

Function scan_with_count_limit

nodedb/src/engine/kv/scan.rs:194–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

192
193 #[test]
194 fn scan_with_count_limit() {
195 let mut t = KvHashTable::new(16, 0.75, 4, 64);
196 for i in 0..10u8 {
197 t.put(&[i], &[i * 10], NO_EXPIRY, Surrogate::ZERO);
198 }
199
200 let (entries, next) = t.scan(0, 3, 0, None);
201 assert_eq!(entries.len(), 3);
202 assert_ne!(next, 0); // More entries available.
203
204 // Continue from cursor.
205 let (entries2, _) = t.scan(next, 100, 0, None);
206 assert_eq!(entries.len() + entries2.len(), 10);
207 }
208
209 #[test]
210 fn scan_skips_expired() {

Callers

nothing calls this directly

Calls 2

putMethod · 0.45
scanMethod · 0.45

Tested by

no test coverage detected