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

StorageRegistry - a class that manages requests from other microservices to register interest in new readings being inserted into the storage layer that match a given asset code, or any asset code "*". More...

#include <storage_registry.h>

Public Member Functions

 StorageRegistry ()
 StorageRegistry constructor. More...
 
 ~StorageRegistry ()
 StorageRegistry destructor.
 
void registerAsset (const std::string &asset, const std::string &url)
 Handle a registration request from a client of the storage layer. More...
 
void unregisterAsset (const std::string &asset, const std::string &url)
 Handle a request to remove a registration of interest. More...
 
void process (const std::string &payload)
 Process a reading append payload and determine if any microservice has registered an interest in this asset. More...
 
void processTableInsert (const std::string &tableName, const std::string &payload)
 Process a table insert payload and determine if any microservice has registered an interest in this table. More...
 
void processTableUpdate (const std::string &tableName, const std::string &payload)
 Process a table update payload and determine if any microservice has registered an interest in this table. More...
 
void processTableDelete (const std::string &tableName, const std::string &payload)
 Process a table delete payload and determine if any microservice has registered an interest in this table. More...
 
void registerTable (const std::string &table, const std::string &url)
 Handle a registration request for a table from a client of the storage layer. More...
 
void unregisterTable (const std::string &table, const std::string &url)
 Handle a request to remove a registration of interest in a table. More...
 
void run ()
 The worker function that processes the queue of payloads that may need to be sent to subscribers.
 

Detailed Description

StorageRegistry - a class that manages requests from other microservices to register interest in new readings being inserted into the storage layer that match a given asset code, or any asset code "*".

Constructor & Destructor Documentation

◆ StorageRegistry()

StorageRegistry::StorageRegistry ( )

StorageRegistry constructor.

The storage registry holds registrations for other micro services that wish to receive notifications when new data is avialable for a given asset. The interested service registers a URL and an asset code, or * for all assets, that URL will then be called when new data arrives for the particular asset.

The service registry maintians a worker thread that is responsible for sending these notifications such that the main flow of data into the storage layer is minimally impacted by the registration and delivery of these messages to interested microservices.

Member Function Documentation

◆ process()

void StorageRegistry::process ( const std::string &  payload)

Process a reading append payload and determine if any microservice has registered an interest in this asset.

Parameters
payloadThe reading append payload

◆ processTableDelete()

void StorageRegistry::processTableDelete ( const std::string &  tableName,
const std::string &  payload 
)

Process a table delete payload and determine if any microservice has registered an interest in this table.

Called from StorageApi::commonDelete()

Parameters
payloadThe table delete payload

◆ processTableInsert()

void StorageRegistry::processTableInsert ( const std::string &  tableName,
const std::string &  payload 
)

Process a table insert payload and determine if any microservice has registered an interest in this table.

Called from StorageApi::commonInsert()

Parameters
payloadThe table insert payload

◆ processTableUpdate()

void StorageRegistry::processTableUpdate ( const std::string &  tableName,
const std::string &  payload 
)

Process a table update payload and determine if any microservice has registered an interest in this table.

Called from StorageApi::commonUpdate()

Parameters
payloadThe table update payload

◆ registerAsset()

void StorageRegistry::registerAsset ( const std::string &  asset,
const std::string &  url 
)

Handle a registration request from a client of the storage layer.

Parameters
assetThe asset of interest
urlThe URL to call

◆ registerTable()

void StorageRegistry::registerTable ( const std::string &  table,
const std::string &  url 
)

Handle a registration request for a table from a client of the storage layer.

Parameters
tableThe table of interest
payloadJSON payload describing the interest

◆ unregisterAsset()

void StorageRegistry::unregisterAsset ( const std::string &  asset,
const std::string &  url 
)

Handle a request to remove a registration of interest.

Parameters
assetThe asset of interest
urlThe URL to call

◆ unregisterTable()

void StorageRegistry::unregisterTable ( const std::string &  table,
const std::string &  url 
)

Handle a request to remove a registration of interest in a table.

Parameters
tableThe table of interest
payloadJSON payload describing the interest

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