Open a WAL file for lazy reading.
(path: &Path)
| 42 | impl LazyWalReader { |
| 43 | /// Open a WAL file for lazy reading. |
| 44 | pub fn open(path: &Path) -> Result<Self> { |
| 45 | let file = File::open(path)?; |
| 46 | let dwb_path = path.with_extension("dwb"); |
| 47 | let double_write = if dwb_path.exists() { |
| 48 | crate::double_write::DoubleWriteBuffer::open( |
| 49 | &dwb_path, |
| 50 | crate::double_write::DwbMode::Buffered, |
| 51 | ) |
| 52 | .ok() |
| 53 | } else { |
| 54 | None |
| 55 | }; |
| 56 | Ok(Self { |
| 57 | file, |
| 58 | offset: 0, |
| 59 | double_write, |
| 60 | }) |
| 61 | } |
| 62 | |
| 63 | /// Read the next record header (30 bytes) without reading the payload. |
| 64 | /// |