31#ifndef DETERMINISTICESPASYNCWEBSERVER_WAL_STORE_H
32#define DETERMINISTICESPASYNCWEBSERVER_WAL_STORE_H
42#define WAL_SUPER_MAGIC 0x31425357u
45#define WAL_SUPER_SIZE 64
48#define WAL_DATA_OFFSET (2u * (uint32_t)WAL_SUPER_SIZE)
60 size_t (*read)(
void *ctx, uint64_t off, uint8_t *buf,
size_t len);
61 size_t (*write)(
void *ctx, uint64_t off,
const uint8_t *buf,
size_t len);
62 bool (*sync)(
void *ctx);
84bool wal_store_format(WalStore *s,
const WalDev *dev);
91bool wal_store_mount(WalStore *s,
const WalDev *dev);
98bool wal_store_append(WalStore *s,
const uint8_t *payload, uint32_t len);
104bool wal_store_checkpoint(WalStore *s);
108using WalStoreRecordCb = void (*)(uint64_t seq, uint64_t data_off,
const uint8_t *payload, uint32_t len,
void *ctx);
117size_t wal_store_scan(WalStore *s, WalStoreRecordCb cb,
void *ctx, uint8_t *scratch,
size_t scratch_len);
123bool wal_store_pread(WalStore *s, uint64_t off, uint8_t *buf,
size_t len);
126static inline uint64_t wal_store_used(
const WalStore *s)
131static inline uint64_t wal_store_committed(
const WalStore *s)
136static inline uint64_t wal_store_capacity(
const WalStore *s)
User-facing configuration for DeterministicESPAsyncWebServer.
Write-ahead journal for atomic buffer-to-flash storage (DETWS_ENABLE_WAL).