Skip to content

Commit 7194459

Browse files
nokute78edsiper
authored andcommitted
input: support flb_input_collector_delete
To delete a registered collector event from input plugin instance. Signed-off-by: Takahiro Yamashita <[email protected]>
1 parent 24994e0 commit 7194459

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

include/fluent-bit/flb_input.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ int flb_input_collector_start(int coll_id, struct flb_input_instance *ins);
508508
int flb_input_collectors_start(struct flb_config *config);
509509
int flb_input_collector_pause(int coll_id, struct flb_input_instance *ins);
510510
int flb_input_collector_resume(int coll_id, struct flb_input_instance *ins);
511+
int flb_input_collector_delete(int coll_id, struct flb_input_instance *ins);
511512
int flb_input_collector_fd(flb_pipefd_t fd, struct flb_config *config);
512513
int flb_input_set_collector_time(struct flb_input_instance *ins,
513514
int (*cb_collect) (struct flb_input_instance *,

src/flb_input.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,24 @@ int flb_input_collector_pause(int coll_id, struct flb_input_instance *in)
876876
return 0;
877877
}
878878

879+
int flb_input_collector_delete(int coll_id, struct flb_input_instance *in)
880+
{
881+
struct flb_input_collector *coll;
882+
883+
coll = get_collector(coll_id, in);
884+
if (!coll) {
885+
return -1;
886+
}
887+
if (flb_input_collector_pause(coll_id, in) < 0) {
888+
return -1;
889+
}
890+
891+
mk_list_del(&coll->_head);
892+
mk_list_del(&coll->_head_ins);
893+
flb_free(coll);
894+
return 0;
895+
}
896+
879897
int flb_input_collector_resume(int coll_id, struct flb_input_instance *in)
880898
{
881899
int fd;

0 commit comments

Comments
 (0)