DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
wal_fs.h File Reference

Bind the WAL store's ::WalDev block-device seam to a real fs::FS file (DETWS_ENABLE_WAL, ESP32 only). More...

#include "ServerConfig.h"

Go to the source code of this file.

Detailed Description

Bind the WAL store's ::WalDev block-device seam to a real fs::FS file (DETWS_ENABLE_WAL, ESP32 only).

The store in wal_store.h does all I/O through three function pointers so its logic stays pure and host-testable; this header is the thin, device-only adapter that points those pointers at a preallocated fs::File on any Arduino filesystem - an SD card or LittleFS. Random access uses File::seek, and the durability barrier is File::flush.

Usage:

wal_fs_prealloc(SD, "/wal.bin", 256 * 1024); // once: fixed-size, zero-filled backing file
fs::File f = SD.open("/wal.bin", "r+"); // random read+write, no truncation
WalDev dev = wal_fs_dev(&f, 256 * 1024);
WalStore s;
wal_store_mount(&s, &dev) || wal_store_format(&s, &dev); // recover, or initialize a fresh file

The backing file is preallocated to a fixed size so every store offset lands inside it and seek+write overwrites in place (no sparse-file / past-EOF behavior differences between FAT and LittleFS). The fs::File must outlive any ::WalDev bound to it.

Definition in file wal_fs.h.