![]() |
Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
|
DEMO |
Sequential WAL file reader for crash recovery and replay. More...
#include <wal.hpp>
Public Types | |
| enum class | ValidationMode : uint8_t { BestEffort = 0 , Strict = 1 } |
Public Member Functions | |
| WalReader (const WalReader &)=delete | |
| WalReader & | operator= (const WalReader &)=delete |
| WalReader (WalReader &&o) noexcept | |
| WalReader & | operator= (WalReader &&)=delete |
| ~WalReader () | |
| expected< std::optional< WalEntry > > | next () |
| Read the next WAL entry from the file. | |
| expected< std::vector< WalEntry > > | read_all () |
| Read all valid entries from the current position to end-of-valid-data. | |
| int64_t | last_seq () const noexcept |
| Sequence number of the last successfully read record (-1 if none). | |
| int64_t | count () const noexcept |
| Number of records successfully read so far. | |
| size_t | offset () const noexcept |
| Current byte offset in the file (past the last read record). | |
| void | close () |
| Close the underlying file handle. | |
Static Public Member Functions | |
| static expected< WalReader > | open (const std::string &path, ValidationMode mode=ValidationMode::BestEffort) |
| Open a WAL file for sequential reading. | |
Sequential WAL file reader for crash recovery and replay.
Reads records forward from the file header, validating magic bytes and CRC-32 integrity. Stops gracefully on truncation, corruption, or EOF (returns nullopt rather than Error for soft failures).
Non-copyable, move-constructible. Use WalReader::open() to create.
|
strong |
|
delete |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
Read the next WAL entry from the file.
Returns nullopt on clean EOF, truncation, bad magic, oversized records, or CRC mismatch (all treated as soft end-of-valid-data). Returns an Error only on hard I/O failures (fread sets errno).
|
inlinenoexcept |
|
inlinestatic |
Open a WAL file for sequential reading.
Validates the 16-byte file header magic. After opening, call next() or read_all() to iterate records.
| path | Filesystem path to the WAL file. |