danielealbano / cachegrand

cachegrand - a modern data ingestion, processing and serving platform built for today's hardware
BSD 3-Clause "New" or "Revised" License
975 stars 34 forks source link

Implement modules support #378

Closed danielealbano closed 1 year ago

danielealbano commented 1 year ago

This PR reorganize how modules are registered and used in cachegrand to provide a very initial abstractions and allow to start to keep certain kind of functionalities properly isolated internally.

Modules need to call the module_register function via a ctor (e.g. with FUNCTION_CTOR).

Modules can currently register for 5 different type, some optional some mandatory of events:

The registration name must match the type of the module in the config file.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 83.56% and project coverage change: -0.05 :warning:

Comparison is base (c97a6a8) 78.44% compared to head (5ca4501) 78.39%.

:exclamation: Current head 5ca4501 differs from pull request most recent head 5e4d729. Consider uploading reports for the commit 5e4d729 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #378 +/- ## ========================================== - Coverage 78.44% 78.39% -0.05% ========================================== Files 184 187 +3 Lines 12948 12994 +46 ========================================== + Hits 10157 10186 +29 - Misses 2791 2808 +17 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `78.39% <83.56%> (-0.05%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/danielealbano/cachegrand/pull/378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano) | Coverage Δ | | |---|---|---| | [src/config\_cyaml\_schema.c](https://codecov.io/gh/danielealbano/cachegrand/pull/378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL2NvbmZpZ19jeWFtbF9zY2hlbWEuYw==) | `100.00% <ø> (ø)` | | | [src/network/io/network\_io\_common.c](https://codecov.io/gh/danielealbano/cachegrand/pull/378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL25ldHdvcmsvaW8vbmV0d29ya19pb19jb21tb24uYw==) | `92.41% <ø> (ø)` | | | [src/module/module.h](https://codecov.io/gh/danielealbano/cachegrand/pull/378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL21vZHVsZS9tb2R1bGUuaA==) | `66.67% <66.67%> (ø)` | | | [src/worker/worker.c](https://codecov.io/gh/danielealbano/cachegrand/pull/378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL3dvcmtlci93b3JrZXIuYw==) | `82.97% <75.00%> (-0.52%)` | :arrow_down: | | [src/config.c](https://codecov.io/gh/danielealbano/cachegrand/pull/378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL2NvbmZpZy5j) | `77.99% <80.95%> (-0.63%)` | :arrow_down: | | [src/module/redis/module\_redis\_connection.c](https://codecov.io/gh/danielealbano/cachegrand/pull/378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL21vZHVsZS9yZWRpcy9tb2R1bGVfcmVkaXNfY29ubmVjdGlvbi5j) | `76.54% <82.14%> (+3.60%)` | :arrow_up: | | [src/module/redis/module\_redis.c](https://codecov.io/gh/danielealbano/cachegrand/pull/378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL21vZHVsZS9yZWRpcy9tb2R1bGVfcmVkaXMuYw==) | `83.33% <83.33%> (+0.94%)` | :arrow_up: | | [src/module/module.c](https://codecov.io/gh/danielealbano/cachegrand/pull/378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL21vZHVsZS9tb2R1bGUuYw==) | `92.86% <92.86%> (ø)` | | | [src/intrinsics.c](https://codecov.io/gh/danielealbano/cachegrand/pull/378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL2ludHJpbnNpY3MuYw==) | `66.67% <100.00%> (ø)` | | | [src/module/prometheus/module\_prometheus.c](https://codecov.io/gh/danielealbano/cachegrand/pull/378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL21vZHVsZS9wcm9tZXRoZXVzL21vZHVsZV9wcm9tZXRoZXVzLmM=) | `91.73% <100.00%> (+0.03%)` | :arrow_up: | | ... and [6 more](https://codecov.io/gh/danielealbano/cachegrand/pull/378?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano) | | ... and [5 files with indirect coverage changes](https://codecov.io/gh/danielealbano/cachegrand/pull/378/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.