![]() |
Fledge
An open source edge computing platform for industrial users
|
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. | |
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 "*".
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.
void StorageRegistry::process | ( | const std::string & | payload | ) |
Process a reading append payload and determine if any microservice has registered an interest in this asset.
payload | The reading append payload |
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()
payload | The table delete payload |
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()
payload | The table insert payload |
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()
payload | The table update payload |
void StorageRegistry::registerAsset | ( | const std::string & | asset, |
const std::string & | url | ||
) |
Handle a registration request from a client of the storage layer.
asset | The asset of interest |
url | The URL to call |
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.
table | The table of interest |
payload | JSON payload describing the interest |
void StorageRegistry::unregisterAsset | ( | const std::string & | asset, |
const std::string & | url | ||
) |
Handle a request to remove a registration of interest.
asset | The asset of interest |
url | The URL to call |
void StorageRegistry::unregisterTable | ( | const std::string & | table, |
const std::string & | url | ||
) |
Handle a request to remove a registration of interest in a table.
table | The table of interest |
payload | JSON payload describing the interest |