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

Function push_and_read

nodedb/src/event/cdc/buffer.rs:286–306  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

284
285 #[test]
286 fn push_and_read() {
287 let buf = StreamBuffer::new(
288 "test".into(),
289 RetentionConfig {
290 max_events: 100,
291 max_age_secs: 3600,
292 },
293 );
294
295 for i in 1..=5 {
296 buf.push(make_event(i, i * 10));
297 }
298
299 assert_eq!(buf.len(), 5);
300 assert_eq!(buf.earliest_lsn(), Some(10));
301 assert_eq!(buf.latest_lsn(), Some(50));
302
303 let events = buf.read_from_lsn(20, 10);
304 assert_eq!(events.len(), 3);
305 assert_eq!(events[0].lsn, 30);
306 }
307
308 #[test]
309 fn evicts_at_capacity() {

Callers

nothing calls this directly

Calls 3

read_from_lsnMethod · 0.80
make_eventFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected