Fledge
An open source edge computing platform for industrial users
FilterPipeline Class Reference

The FilterPipeline class is used to represent a pipeline of filters applicable to a task/service. More...

#include <filter_pipeline.h>

Inheritance diagram for FilterPipeline:
Collaboration diagram for FilterPipeline:

Public Member Functions

 FilterPipeline (ManagementClient *mgtClient, StorageClient &storage, std::string serviceName)
 FilterPipeline class constructor. More...
 
 ~FilterPipeline ()
 FilterPipeline destructor.
 
PipelineElementgetFirstFilterPlugin ()
 
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

ManagementClientmgtClient
 
StorageClientstorage
 
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
 
ServiceHandlerm_serviceHandler
 
int m_activeBranches
 
std::mutex m_actives
 
std::condition_variable m_branchActivations
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FilterPipeline()

FilterPipeline::FilterPipeline ( ManagementClient mgtClient,
StorageClient storage,
std::string  serviceName 
)

FilterPipeline class constructor.

This class abstracts the filter pipeline interface

Parameters
mgtClientManagement client handle
storageStorage client handle
serviceNameName of the service to which this pipeline applies

Member Function Documentation

◆ cleanupFilters()

void FilterPipeline::cleanupFilters ( const std::string &  categoryName)

Cleanup all the loaded filters.

Call "plugin_shutdown" method and free the FilterPlugin object

Parameters
categoryNameConfiguration category name

◆ configChange()

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.

Parameters
categoryThe name of the configuration category
newConfigThe new category contents

◆ execute()

void FilterPipeline::execute ( )

Called when we pass the data into the pipeline.

Set the number of active branches to 1

◆ loadFilters()

bool FilterPipeline::loadFilters ( const std::string &  categoryName)

Load all filter plugins in the pipeline.

Parameters
categoryNameConfiguration category name
Returns
True if filters are loaded (or no filters at all) False otherwise

◆ setupFiltersPipeline()

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"

Parameters
passToOnwardFilterPtr to function that passes data to next filter
useFilteredDataPtr to function that gets final filtered data
ingestThe ingest class handle
Returns
True on success, False otherwise. Any caught exception

The documentation for this class was generated from the following files: