![]() |
Fledge
An open source edge computing platform for industrial users
|
The FilterPipeline class is used to represent a pipeline of filters applicable to a task/service. More...
#include <filter_pipeline.h>
Public Member Functions | |
FilterPipeline (ManagementClient *mgtClient, StorageClient &storage, std::string serviceName) | |
FilterPipeline class constructor. More... | |
~FilterPipeline () | |
FilterPipeline destructor. | |
PipelineElement * | getFirstFilterPlugin () |
unsigned int | getFilterCount () |
void | configChange (const std::string &, const std::string &) |
Configuration change for one of the filters. More... | |
void | cleanupFilters (const std::string &categoryName) |
Cleanup all the loaded filters. More... | |
bool | loadFilters (const std::string &categoryName) |
Load all filter plugins in the pipeline. More... | |
bool | setupFiltersPipeline (void *passToOnwardFilter, void *useFilteredData, void *ingest) |
Set the filter pipeline. More... | |
bool | isReady () |
bool | hasChanged (const std::string pipeline) const |
bool | isShuttingDown () |
void | setShuttingDown () |
void | execute () |
Called when we pass the data into the pipeline. More... | |
void | awaitCompletion () |
Wait for all active branches of the pipeline to complete. | |
void | startBranch () |
A new branch has started in the pipeline. | |
void | completeBranch () |
A branch in the pipeline has completed. | |
Protected Attributes | |
ManagementClient * | mgtClient |
StorageClient & | storage |
std::string | serviceName |
std::vector< PipelineElement * > | m_filters |
std::map< std::string, PipelineElement * > | m_filterCategories |
std::string | m_pipeline |
bool | m_ready |
bool | m_shutdown |
ServiceHandler * | m_serviceHandler |
int | m_activeBranches |
std::mutex | m_actives |
std::condition_variable | m_branchActivations |
The FilterPipeline class is used to represent a pipeline of filters applicable to a task/service.
Methods are provided to load filters, setup filtering pipeline and for pipeline/filters cleanup.
FilterPipeline::FilterPipeline | ( | ManagementClient * | mgtClient, |
StorageClient & | storage, | ||
std::string | serviceName | ||
) |
FilterPipeline class constructor.
This class abstracts the filter pipeline interface
mgtClient | Management client handle |
storage | Storage client handle |
serviceName | Name of the service to which this pipeline applies |
void FilterPipeline::cleanupFilters | ( | const std::string & | categoryName | ) |
Cleanup all the loaded filters.
Call "plugin_shutdown" method and free the FilterPlugin object
categoryName | Configuration category name |
void FilterPipeline::configChange | ( | const std::string & | , |
const std::string & | |||
) |
Configuration change for one of the filters.
Lookup the category name and find the plugin to call. Call the reconfigure method of that plugin with the new configuration.
category | The name of the configuration category |
newConfig | The new category contents |
void FilterPipeline::execute | ( | ) |
Called when we pass the data into the pipeline.
Set the number of active branches to 1
bool FilterPipeline::loadFilters | ( | const std::string & | categoryName | ) |
Load all filter plugins in the pipeline.
categoryName | Configuration category name |
bool FilterPipeline::setupFiltersPipeline | ( | void * | passToOnwardFilter, |
void * | useFilteredData, | ||
void * | ingest | ||
) |
Set the filter pipeline.
This method calls the method "plugin_init" for all loadad filters. Up-to-date filter configurations and Ingest filtering methods are passed to "plugin_init"
passToOnwardFilter | Ptr to function that passes data to next filter |
useFilteredData | Ptr to function that gets final filtered data |
ingest | The ingest class handle |