()
| 209 | |
| 210 | #[test] |
| 211 | fn lazy_read_all_payloads() { |
| 212 | let dir = tempfile::tempdir().unwrap(); |
| 213 | let path = dir.path().join("test.wal"); |
| 214 | |
| 215 | { |
| 216 | let mut w = WalWriter::open_without_direct_io(&path).unwrap(); |
| 217 | w.append(RecordType::Put as u32, 1, 0, 0, b"hello").unwrap(); |
| 218 | w.append(RecordType::VectorPut as u32, 1, 0, 0, b"vector-data") |
| 219 | .unwrap(); |
| 220 | w.append(RecordType::Put as u32, 2, 1, 0, b"world").unwrap(); |
| 221 | w.sync().unwrap(); |
| 222 | } |
| 223 | |
| 224 | let mut reader = LazyWalReader::open(&path).unwrap(); |
| 225 | let mut records = Vec::new(); |
| 226 | while let Some(header) = reader.next_header().unwrap() { |
| 227 | let payload = reader.read_payload(&header).unwrap(); |
| 228 | records.push((header, payload)); |
| 229 | } |
| 230 | assert_eq!(records.len(), 3); |
| 231 | assert_eq!(records[0].1, b"hello"); |
| 232 | assert_eq!(records[1].1, b"vector-data"); |
| 233 | assert_eq!(records[2].1, b"world"); |
| 234 | } |
| 235 | |
| 236 | #[test] |
| 237 | fn lazy_skip_non_matching() { |
nothing calls this directly
no test coverage detected