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

A class used in the North service to load data from the buffer. More...

#include <data_load.h>

Inheritance diagram for DataLoad:
Collaboration diagram for DataLoad:

Public Member Functions

 DataLoad (const std::string &name, long streamId, StorageClient *storage)
 DataLoad Constructor. More...
 
virtual ~DataLoad ()
 DataLoad destructor. More...
 
void loadThread ()
 The background thread that loads data from the database.
 
bool setDataSource (const std::string &source)
 Set the source of data for the service. More...
 
void triggerRead (unsigned int blockSize)
 Trigger the loading thread to read a block of data. More...
 
void updateLastSentId (unsigned long id)
 Update the last sent ID for our stream.
 
void flushLastSentId ()
 Flush the last sent Id to the storeage layer.
 
ReadingSetfetchReadings (bool wait)
 Fetch Readings. More...
 
void shutdown ()
 External call to shutdown the north service.
 
void restart ()
 External call to restart the north service.
 
bool isRunning ()
 
void configChange (const std::string &category, const std::string &newConfig)
 Configuration change for one of the filters or to the pipeline. More...
 
void configChildCreate (const std::string &, const std::string &, const std::string &)
 
void configChildDelete (const std::string &, const std::string &)
 
unsigned long getLastFetched ()
 
void setBlockSize (unsigned long blockSize)
 
void setStreamUpdate (unsigned long streamUpdate)
 
void setPerfMonitor (PerformanceMonitor *perfMonitor)
 
const std::string & getName ()
 
StorageClientgetStorage ()
 
void setPrefetchLimit (unsigned int limit)
 
- Public Member Functions inherited from ServiceHandler
virtual bool securityChange (const std::string &payload)
 

Static Public Member Functions

static void passToOnwardFilter (OUTPUT_HANDLE *outHandle, READINGSET *readings)
 Pass the current readings set to the next filter in the pipeline. More...
 
static void pipelineEnd (OUTPUT_HANDLE *outHandle, READINGSET *readings)
 Use the current readings (they have been filtered by all filters) More...
 

Detailed Description

A class used in the North service to load data from the buffer.

This class is responsible for loading the reading from the storage service and buffering them ready for the egress thread to process them.

Constructor & Destructor Documentation

◆ DataLoad()

DataLoad::DataLoad ( const std::string &  name,
long  streamId,
StorageClient storage 
)

DataLoad Constructor.

Create and start the loading thread

◆ ~DataLoad()

DataLoad::~DataLoad ( )
virtual

DataLoad destructor.

Shutdown and wait for the loading thread

Member Function Documentation

◆ configChange()

void DataLoad::configChange ( const std::string &  category,
const std::string &  newConfig 
)
virtual

Configuration change for one of the filters or to the pipeline.

Parameters
categoryThe name of the configuration category
newConfigThe new category contents

The category that has changed is the one for the north service itself. The only items that concerns us here is the filter item that defines the filter pipeline and the data source. If the item is the filter pipeline we extract that item and check to see if it defines a pipeline that is different to the one we currently have.

If it is the filter pipeline we destroy the current pipeline and create a new one.

Implements ServiceHandler.

◆ fetchReadings()

ReadingSet * DataLoad::fetchReadings ( bool  wait)

Fetch Readings.

Parameters
waitBoolean to determine if the call should block the calling thread
Returns
ReadingSet* Return a block of readings from the buffer

◆ passToOnwardFilter()

void DataLoad::passToOnwardFilter ( OUTPUT_HANDLE *  outHandle,
READINGSET readingSet 
)
static

Pass the current readings set to the next filter in the pipeline.

Note: This routine must be passed to all filters "plugin_init" except the last one

Static method

Parameters
outHandlePointer to next filter
readingsCurrent readings set

◆ pipelineEnd()

void DataLoad::pipelineEnd ( OUTPUT_HANDLE *  outHandle,
READINGSET readingSet 
)
static

Use the current readings (they have been filtered by all filters)

The assumption is that one of two things has happened.

  1. The filtering has all been done in place. In which case the m_data vector is in the ReadingSet passed in here.
  2. The filtering has created new ReadingSet in which case the reading vector must be copied into m_data from the ReadingSet.

Note: This routine must be passed to last filter "plugin_init" only

Static method

Parameters
outHandlePointer to DataLoad class
readingSetFiltered reading set being added to Ingest::m_data

◆ setDataSource()

bool DataLoad::setDataSource ( const std::string &  source)

Set the source of data for the service.

Parameters
sourceThe data source

◆ triggerRead()

void DataLoad::triggerRead ( unsigned int  blockSize)

Trigger the loading thread to read a block of data.

This is called by any thread to request that data be added to the buffer ready for collection.


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