30#ifndef PROTOCORE_WAL_H
31#define PROTOCORE_WAL_H
35#if PROTOCORE_ENABLE_WAL
40#define WAL_RECORD_HEADER 20
43#define WAL_MAGIC 0x314C4157u
46uint32_t protocore_wal_crc32(
const uint8_t *data,
size_t len);
55uint32_t protocore_wal_crc32_init(
void);
56uint32_t protocore_wal_crc32_update(uint32_t crc,
const uint8_t *d,
size_t n);
57uint32_t protocore_wal_crc32_final(uint32_t crc);
66size_t protocore_wal_record_encode(uint8_t *out,
size_t cap, uint64_t seq,
const uint8_t *payload, uint32_t len);
69typedef void (*WalRecordCb)(uint64_t seq,
const uint8_t *payload, uint32_t len,
void *ctx);
78size_t protocore_wal_replay(
const uint8_t *img,
size_t len, WalRecordCb cb,
void *ctx);
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
#define PROTOCORE_END_DECLS