msharee9 commented on a change in pull request #604: MINIFICPP-926 Create
nanofi tailfile processor for tailing file by configurable chunk size
URL: https://github.com/apache/nifi-minifi-cpp/pull/604#discussion_r301082554
##########
File path: nanofi/src/api/ecu.c
##########
@@ -0,0 +1,130 @@
+
+#include "api/ecu.h"
+#include "api/nanofi.h"
+#include "core/string_utils.h"
+#include "core/cstructs.h"
+#include "core/file_utils.h"
+#include "core/flowfiles.h"
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <limits.h>
+#include <signal.h>
+#include <sys/stat.h>
+
+nifi_instance * instance = NULL;
+standalone_processor * proc = NULL;
+flow_file_list ff_list;
+int curr_offset = 0;
+int stopped = 0;
+
+void signal_handler(int signum) {
+ if (signum == SIGINT || signum == SIGTERM) {
+ stopped = 1;
+ }
+}
+
+void set_offset(int offset) {
+ curr_offset = offset;
+}
+
+int get_offset() {
+ return curr_offset;
+}
+
+void on_trigger_tailfilechunk(processor_session * ps, processor_context * ctx)
{
+ char file_path[4096] = {0};
+ char chunk_size[50] = {0};
+
+ free_flow_file_list(&ff_list);
+
+ if (get_property(ctx, "file_path", file_path, sizeof(file_path)) != 0) {
+ return;
+ }
+
+ if (get_property(ctx, "chunk_size", chunk_size, sizeof(chunk_size)) != 0) {
+ return;
+ }
+
+ errno = 0;
+ unsigned long chunk_size_value = strtol(chunk_size, NULL, 10);
Review comment:
good point.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services