()
| 726 | |
| 727 | #[test] |
| 728 | fn replay_from_limit_basic() { |
| 729 | let dir = tempfile::tempdir().unwrap(); |
| 730 | let config = test_config(dir.path()); |
| 731 | let mut wal = SegmentedWal::open(config).unwrap(); |
| 732 | |
| 733 | // Append 10 records. |
| 734 | for i in 0..10u8 { |
| 735 | wal.append(RecordType::Put as u32, 1, 0, 0, &[i]).unwrap(); |
| 736 | } |
| 737 | wal.sync().unwrap(); |
| 738 | |
| 739 | // Read all with limit > count. |
| 740 | let (records, has_more) = wal.replay_from_limit(1, 100).unwrap(); |
| 741 | assert_eq!(records.len(), 10); |
| 742 | assert!(!has_more); |
| 743 | |
| 744 | // Read with limit = 3. |
| 745 | let (records, has_more) = wal.replay_from_limit(1, 3).unwrap(); |
| 746 | assert_eq!(records.len(), 3); |
| 747 | assert!(has_more); |
| 748 | assert_eq!(records[0].header.lsn, 1); |
| 749 | assert_eq!(records[2].header.lsn, 3); |
| 750 | } |
| 751 | |
| 752 | #[test] |
| 753 | fn replay_from_limit_with_lsn_filter() { |
nothing calls this directly
no test coverage detected