Skip to content

Commit

Permalink
yaml/v2: use stack based parser. (#7661)
Browse files Browse the repository at this point in the history
* yaml/v2: move to a stack based parser.

Use a LIFO list (or stack) to save parser states. This allows code to be
reused between inputs, outputs, filters, customs and processors.

With this support for list-based properties for processors now works.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: remove unused STATE_PROCESSOR_MAP.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: use debug printing the structure/state event messages.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: fix assignment when adding multiple processors.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: move variable declarations out of switch case statements.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: wrap state_names behind state_str function.

Signed-off-by: Phillip Whelan <[email protected]>

* processors: update fallback call in flb_processor_unit_set_property.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: remove unused variables and functions.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: move variable declaration out of case statement.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: rename all instances 'i' to idx and remove local declarations.

Signed-off-by: Phillip Whelan <[email protected]>

* processors: fix memory leak in updated processor test.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: improve tests.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: add single parser file test.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: finish test for parsers_file for yaml.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: move to a stack based parser.

Use a LIFO list (or stack) to save parser states. This allows code to be
reused between inputs, outputs, filters, customs and processors.

With this support for list-based properties for processors now works.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: remove unused STATE_PROCESSOR_MAP.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: windows fixes.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: add missing parsers.conf test file.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: free flb_config in parser test.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: minor section fixes.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: refactor state_name to use a switch case.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: remove single letter variables.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: check return values.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: rewrite allocation flags as macros.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: move all type definitions to the start.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: rename get_last_included_file to state_get_last.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: check return value of snprintf in read_glob.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: fix return value for error in state_push_witharr.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: remove comment.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: adhere to code standard.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: redefine HAS_KEY and HAS_KEYVALS as macros.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: erase redefinitions.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: release local variable 'file' and not 'cfg_file'.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: check list size when getting current state.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: move initialization out of declaration.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: check return value of get_current_state.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: check return value of flb_sds_printf when concatenating filename.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: syntax fixes.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: check everything in yaml_error_event.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: check return values.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: fix bugs introduced by code deduplication.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: check return values for state_get_last.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: fix 'e' undeclared error.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: rename kv to prop.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: add missing error handling.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: fix codig violations in comments.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: rename short variables.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: check return values and fix memory leaks.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: rename file to include_dir.

Signed-off-by: Phillip Whelan <[email protected]>

* yaml/v2: add new line before if, break out else to next line.

Signed-off-by: Phillip Whelan <[email protected]>

---------

Signed-off-by: Phillip Whelan <[email protected]>
  • Loading branch information
pwhelan authored Aug 22, 2023
1 parent 4498a6b commit eabc1a1
Show file tree
Hide file tree
Showing 11 changed files with 1,656 additions and 835 deletions.
2 changes: 1 addition & 1 deletion include/fluent-bit/flb_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ struct flb_processor_unit *flb_processor_unit_create(struct flb_processor *proc,
int event_type,
char *unit_name);
void flb_processor_unit_destroy(struct flb_processor_unit *pu);
int flb_processor_unit_set_property(struct flb_processor_unit *pu, const char *k, const char *v);
int flb_processor_unit_set_property(struct flb_processor_unit *pu, const char *k, struct cfl_variant *v);

int flb_processors_load_from_config_format_group(struct flb_processor *proc, struct flb_cf_group *g);

Expand Down
Loading

0 comments on commit eabc1a1

Please sign in to comment.