Hi, I am looking at the source code of the append-transform plugin.
I have a question regarding the load function below: Is my understanding correct that each call to TSIOBufferProduce(append_buffer, err) appends a read chunk to the static append_buffer causing the buffer to generate an event (that will in turn lead TS to invoke another function of the plugin)? Is the use of a static variable the common approach to keep buffer state? Or is it just to simplify the example? I'd think that multiple invocations of the plugin could interfere with each other. E.g. when more that one request is handled by the thread in question. Or are requests handled sequentially by each thread, causing the static buffer to only be in use for one request at a time. (??). Jan static int load(const char *filename) { TSFile fp; TSIOBufferBlock blk; char *p; int64_t avail; int err; fp = TSfopen(filename, "r"); if (!fp) { return 0; } append_buffer = TSIOBufferCreate(); append_buffer_reader = TSIOBufferReaderAlloc(append_buffer); for (;;) { blk = TSIOBufferStart(append_buffer); p = TSIOBufferBlockWriteStart(blk, &avail); err = TSfread(fp, p, avail); if (err > 0) { TSIOBufferProduce(append_buffer, err); } else { break; } } append_buffer_length = TSIOBufferReaderAvail(append_buffer_reader); TSfclose(fp); return 1; }