Version 0.8

This commit is contained in:
2026-02-19 15:27:47 +01:00
commit 868312edf8
37 changed files with 12782 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
#ifndef WAL_INCLUDED
#define WAL_INCLUDED
#include <lib/file_system.h>
#include <state_machine/state_machine.h>
typedef struct {
uint64_t term;
uint64_t client_id;
Operation oper;
} WALEntry;
typedef struct {
int count;
int capacity;
WALEntry *entries;
Handle handle;
} WAL;
typedef struct {
int count;
int current;
WALEntry *entries;
} WALReplay;
int wal_init(WAL *wal, string file);
void wal_free(WAL *wal);
int wal_append(WAL *wal, WALEntry *entry);
int wal_truncate(WAL *wal, int new_count);
uint64_t wal_last_term(WAL *wal);
int wal_entry_count(WAL *wal);
WALEntry *wal_peek_entry(WAL *wal, int idx);
void wal_replay_init(WALReplay *wal_replay, WAL *wal);
void wal_replay_free(WALReplay *wal_replay);
WALEntry *wal_replay_next(WALReplay *wal_replay);
#endif // WAL_INCLUDED