pub struct Wal { /* private fields */ }Expand description
File-backed active-session WAL.
Implementations§
Source§impl Wal
impl Wal
Sourcepub fn for_layout(layout: &RepositoryLayout) -> Self
pub fn for_layout(layout: &RepositoryLayout) -> Self
Create a WAL handle authorized by a validated repository layout.
Sourcepub fn append_patch(&self, envelope: &ObjectEnvelope) -> Result<u64>
pub fn append_patch(&self, envelope: &ObjectEnvelope) -> Result<u64>
Append a signed patch envelope and fsync the WAL file.
Sourcepub fn truncate_trailing_partial(&self) -> Result<WalRepair>
pub fn truncate_trailing_partial(&self) -> Result<WalRepair>
Safely truncate an incomplete trailing WAL record, if one exists.
This repairs only the case that FDD-02 defines as safe: valid records followed by an
incomplete final record. RFC 102 Stage 2: a mid-stream checksum mismatch in a complete
record no longer makes decode_records return Err – it is now an item finding
(WalReplay::has_item_failure), which this function refuses on explicitly below rather than
silently truncating around. The only production caller (doctor.rs’s repair_repository)
already refuses earlier via doctor_repository’s own item-outcome reporting; this check is
defense in depth for this function’s own contract, not the only thing enforcing it.
Sourcepub fn truncate_empty(&self) -> Result<()>
pub fn truncate_empty(&self) -> Result<()>
Truncate the WAL after a successful publication that made all entries durable elsewhere.
Sourcepub fn next_sequence(&self) -> Result<u64>
pub fn next_sequence(&self) -> Result<u64>
Return the next sequence number for append.