1 // ================================================================
2 // Abstraction layer for stdio file-read logic, when ingesting entirely into memory.
3 // ================================================================
4 
5 #ifndef FILE_INGESTOR_STDIO_H
6 #define FILE_INGESTOR_STDIO_H
7 
8 typedef struct _file_ingestor_stdio_state_t {
9 	char* sof;
10 	char* eof;
11 } file_ingestor_stdio_state_t;
12 
13 // The vclose method frees memory. The nop flavor does not. The latter is used by the JSON-input
14 // lrec reader: lrecs have keys/values pointing into parsed-JSON structures which in turn have
15 // values pointing to the ingested-file buffer.  This is done for the sake of performance, to reduce
16 // data-copies. But it also means we can't free ingested files after ingesting their contents into
17 // lrecs, since the lrecs in question might be retained after the input-file closes.  Example: mlr
18 // sort on multiple files.
19 void* file_ingestor_stdio_vopen(void* pvstate, char* prepipe, char* file_name);
20 void  file_ingestor_stdio_vclose(void* pvstate, void* pvhandle, char* prepipe);
21 void  file_ingestor_stdio_nop_vclose(void* pvstate, void* pvhandle, char* prepipe);
22 
23 #endif // FILE_INGESTOR_STDIO_H
24