|
Csilk 0.2.1
A lightweight, high-performance C HTTP web framework
|
Binary Write-Ahead Log implementation for AI workflows. More...
#include "csilk/app/workflow_wal.h"#include <fcntl.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/stat.h>#include <time.h>#include <unistd.h>
Functions | |
| int | _wf_wal_append (const char *wal_path, csilk_wf_event_type_t type, const void *payload, size_t len) |
| Append an event record to the workflow Write-Ahead Log. | |
Binary Write-Ahead Log implementation for AI workflows.
Architecture: Crash-safe durability for workflow execution state. Events (node start, node finish, workflow end) are written as fixed-size headers + variable-length payloads to a binary WAL file. Each record is fsynced before returning to guarantee durability.
The WAL is replayed during csilk_wf_resume() to reconstruct the workflow's execution state after a crash or restart.
Wire format: [magic:4 bytes][type:1 byte][timestamp:4 bytes][payload_len:4 bytes] [payload:payload_len bytes]
| int _wf_wal_append | ( | const char * | wal_path, |
| csilk_wf_event_type_t | type, | ||
| const void * | payload, | ||
| size_t | len | ||
| ) |
Append an event record to the workflow Write-Ahead Log.
Append a WAL record to the log file.
Algorithm:
| wal_path | Absolute path to the WAL file. |
| type | Event type (e.g., WF_EV_START, WF_EV_NODE_FINISH). |
| payload | Opaque payload data to persist (may be NULL if len is 0). |
| len | Number of payload bytes. |