pub struct WalConfig {
pub segment_size: u64,
pub max_record_size: u32,
}Expand description
Configuration for a WAL instance.
Both fields are caller-supplied (§11 of docs/wal_design_v6.md). Tests use
tiny sizes to force segment rolls and commit-time splits.
Fields§
§segment_size: u64Bytes pre-allocated per segment file. Default in production: 128 MiB.
max_record_size: u32Hard upper bound on a single record’s payload length.
A record must not span segments (§5.3), so this is constrained by
max_record_size + 91 <= segment_size (64-byte segment header +
20-byte record header + up to 7 padding bytes). The bound is written in
additive form on purpose: the equivalent segment_size - 91 underflows
for segment_size < 91, which would bypass the check. That precondition
is not enforced by this struct; Wal::open
validates it and returns
InvalidConfig when violated.
Trait Implementations§
impl Copy for WalConfig
Source§impl Default for WalConfig
impl Default for WalConfig
Source§fn default() -> Self
fn default() -> Self
Production-oriented defaults: a 128 MiB segment with a 1 MiB max payload.
These match the sizing guidance in §5.3/§11 (payloads ≤ ~1 MiB with a
64–128 MiB segment) and satisfy the max_record_size ≤ segment_size − 91
precondition with large headroom, so a default-configured WAL always
passes open()’s validation.