|
PineForge unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
|
Borrowed sequential stream sink descriptor (CX-SINK-B1/B2). More...
#include <report_sink.h>
Data Fields | |
| uint32_t | struct_size |
| uint32_t | version |
| int | fd |
| const char * | run_id |
Borrowed sequential stream sink descriptor (CX-SINK-B1/B2).
struct_size is sizeof(pf_report_sink_fd_v1), version is 1. fd is the caller-selected write end of a FIFO or AF_UNIX SOCK_STREAM socket; there is no library default fd number. NULL run_id means ""; it is copied. No path or scratch directory is supplied or derived for this sink.
The caller keeps fd open through the run and report capture. The library neither duplicates nor closes it, including on replacement, removal, failure, abort or handle destruction. The caller closes it to deliver EOF to the trusted finalizer. A new run on the same fd appends a new stream; use a fresh stream per run when the reader expects one header/trailer. Each begin checks that fd is open and matches its installed device/inode identity; a closed or replaced descriptor fails with report_sink_failed. A host that dup2s a fresh FIFO onto the same descriptor number for the next run must install the sink again.
Bytes, canonical JSON, hashes, LF framing and the 1 MiB line limit are identical to the path sink. Writes are strictly sequential: no open, creation, seek, pwrite, truncation, unlink or rename on this route. Partial writes and EINTR are retried; EAGAIN blocks in poll() with bounded buffering. Only a successful run writes a trailer, as its last line. Failure or abort leaves no valid trailer; the receipt stays incomplete.
Socket writes use send(..., MSG_NOSIGNAL). For a FIFO the host MUST ignore SIGPIPE (Python does by default; C hosts use signal(SIGPIPE, SIG_IGN)) so a closed reader becomes the typed report_sink_failed error. The library never changes process-wide SIGPIPE disposition. A successful new inherited-arena attach sets SIGXFSZ to SIG_IGN process-wide; detach does not restore it. Hosts relying on their SIGXFSZ handler or default termination must account for this before attaching an arena.
Definition at line 61 of file report_sink.h.
| uint32_t pf_report_sink_fd_v1::struct_size |
Definition at line 62 of file report_sink.h.
| uint32_t pf_report_sink_fd_v1::version |
Definition at line 63 of file report_sink.h.
| int pf_report_sink_fd_v1::fd |
Definition at line 64 of file report_sink.h.
| const char* pf_report_sink_fd_v1::run_id |
Definition at line 65 of file report_sink.h.