|
Csilk 0.2.1
A lightweight, high-performance C HTTP web framework
|
Write-Ahead Log (WAL) persistence for the AI Workflow engine. More...


Go to the source code of this file.
Macros | |
| #define | CSILK_WF_MAGIC 0x5746414C /* "WFAL" */ |
| Magic number identifying a WAL file ("WFAL" in ASCII). | |
Enumerations | |
| enum | csilk_wf_event_type_t { WF_EV_START = 1 , WF_EV_NODE_START = 2 , WF_EV_NODE_FINISH = 3 , WF_EV_PAUSE = 4 , WF_EV_END = 5 } |
| Event types recorded in the workflow WAL. More... | |
Functions | |
| struct | __attribute__ ((packed)) |
| Packed binary header prefixed to every WAL record. | |
| int | _wf_wal_append (const char *wal_path, csilk_wf_event_type_t type, const void *payload, size_t len) |
| Append a WAL record to the log file. | |
Variables | |
| csilk_wf_wal_header_t | |
Write-Ahead Log (WAL) persistence for the AI Workflow engine.
Provides fault-tolerant execution logging for csilk_wf_t workflows. Every workflow event (start, node-start, node-finish, end) is appended to a binary log file before it is processed. If the server crashes, interrupted workflows can be resumed by replaying the WAL.
The WAL format is a sequence of packed binary records, each prefixed by a csilk_wf_wal_header_t. The payload is event-type-specific JSON (e.g., node ID, input/output data). This header is internal to the workflow implementation and is not intended for direct use.
| #define CSILK_WF_MAGIC 0x5746414C /* "WFAL" */ |
Magic number identifying a WAL file ("WFAL" in ASCII).
Event types recorded in the workflow WAL.
Each event is written before the corresponding action is performed (write-ahead semantics), ensuring that on recovery we can identify partially-completed executions.
| struct __attribute__ | ( | (packed) | ) |
Packed binary header prefixed to every WAL record.
The header is followed by payload_len bytes of event-specific data (typically a JSON string). Total record size = sizeof(header) + payload_len.
< Must equal CSILK_WF_MAGIC for file validation.
< csilk_wf_event_type_t value.
< Unix timestamp (seconds since epoch) of the event.
< Byte length of the payload that follows this header.
| int _wf_wal_append | ( | const char * | wal_path, |
| csilk_wf_event_type_t | type, | ||
| const void * | payload, | ||
| size_t | len | ||
| ) |
Append a WAL record to the log file.
Internal helper used by workflow.c to persist each event. Creates the log file if it does not yet exist. The WAL directory is set via csilk_wf_set_persistence.
| wal_path | Path to the WAL file. |
| type | Event type enumerator. |
| payload | Event-specific data (typically a JSON string). |
| len | Byte length of payload. |
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. |
| csilk_wf_wal_header_t |