Telemetry Service can subscribe to receive updates from remote nodes on named values. More...
#include <Service.h>

Public Member Functions | |
| virtual void | DescribeService (data::discovery::Response &descriptor) override |
| Add descriptors for the service to the discovery descriptor. More... | |
| data::telemetry::Status | GetCachedStatus (const Node *node) |
| virtual bool | ReceiveMessage (const Node *sender, const data::Message *message) override |
| Delivery point of all messages. More... | |
| void | RegisterObserver (Observer *observer) |
| Register a new status observer. More... | |
| void | RemoveFieldDefinitionForKey (const std::string &key) |
| Remove a field from the schema. More... | |
| void | RemoveValue (const std::string &key) |
| Remove a value from the local telemetry cache. More... | |
| Service (Endpoint *endpoint, std::chrono::milliseconds period=std::chrono::milliseconds(10)) | |
| Construct a new Service object. More... | |
| void | SetFieldDefinitionForKey (const std::string &key, const data::discovery::Field &field, bool includeInStatus) |
| Add field to the schema. More... | |
| void | SetValue (const std::string &key, const data::Variant &value) |
| Add or update a value in the local telemetry cache. More... | |
| void | UnregisterObserver (Observer *observer) |
| Unregister a status observer. More... | |
Public Member Functions inherited from swarmio::Mailbox | |
| virtual void | Disconnect () |
| Disconnect this Mailbox from the Endpoint. More... | |
| Endpoint * | GetEndpoint () |
| Get the associated Endpoint. More... | |
| Mailbox (const Mailbox &)=delete | |
| Remove copy constructor. More... | |
| virtual void | NodeDidJoin (const Node *node) noexcept |
| Called when a new Node has joined the group. More... | |
| virtual void | NodeWasDiscovered (const Node *node) noexcept |
| Called when a new Node has been discovered. More... | |
| virtual void | NodeWillLeave (const Node *node) noexcept |
| Called when a Node signals that it will leave. More... | |
| Mailbox & | operator= (const Mailbox &)=delete |
| Remove assignment operator. More... | |
| virtual | ~Mailbox () |
| Destroy the Mailbox object. More... | |
Static Public Member Functions | |
| static UpdateAwaiter | Subscribe (Endpoint *endpoint, const Node *node, uint32_t interval=1) |
| Subscribe to all named values on the remote node. More... | |
| static UpdateAwaiter | Subscribe (Endpoint *endpoint, const Node *node, uint32_t interval, const std::list< std::string > &keys) |
| Subscribe to soecific named values on the remote node. More... | |
Protected Member Functions | |
| virtual void | Update () overridefinal |
| Send an update to all subscribers. More... | |
Protected Member Functions inherited from swarmio::services::PeriodicService | |
| virtual void | MailboxWasConnected () noexceptoverride |
| Called when the mailbox is attached to an already running endpoint or if the attached endpoint has just started. More... | |
| virtual void | MailboxWillBeDisconnected () noexceptoverride |
| Called right before the mailbox is disconnected from its endpoint or if the attached endpoint is about to stop. More... | |
| PeriodicService (Endpoint *endpoint, std::chrono::milliseconds period) | |
| Construct a new Periodic Service object. More... | |
Protected Member Functions inherited from swarmio::Mailbox | |
| void | FinishConstruction () |
| Called when the last constructor has finished its job. More... | |
| void | FinishMovingTo (Mailbox *other) |
| Called when message handling should be passed onto the new instance. More... | |
| Mailbox () | |
| Construct a disconnected Mailbox. More... | |
| Mailbox (Endpoint *endpoint) | |
| Construct a new Mailbox object. More... | |
| Mailbox (Mailbox &&other) | |
| Move a Mailbox object. More... | |
Private Attributes | |
| std::set< Observer * > | _observers |
| List of observers. More... | |
| std::shared_timed_mutex | _observersMutex |
| Mutex to protect the list of observers. More... | |
| std::map< const Node *, data::telemetry::Status > | _reports |
| Cached values for remote status reports. More... | |
| std::shared_timed_mutex | _reportsMutex |
| Mutex to protect remote status reports. More... | |
| data::discovery::Schema | _schema |
| Schema. More... | |
| std::shared_timed_mutex | _schemaMutex |
| Mutex to protect the schema. More... | |
| std::set< std::string > | _statusKeys |
| List of keys to include in the status broadcast. More... | |
| std::list< Tracker > | _trackers |
| Trackers for each remote subscription. More... | |
| std::shared_timed_mutex | _trackersMutex |
| Mutex to protect the list of trackers. More... | |
| std::map< std::string, data::Variant > | _values |
| List of published telemetry values. More... | |
| std::shared_timed_mutex | _valuesMutex |
| Mutex to protect the map of values. More... | |
Telemetry Service can subscribe to receive updates from remote nodes on named values.
Definition at line 21 of file telemetry/Service.h.
|
inline |
Construct a new Service object.
| endpoint | Endpoint |
| period | Tick period |
Definition at line 132 of file telemetry/Service.h.
|
overridevirtual |
Add descriptors for the service to the discovery descriptor.
| descriptor | The proposed response to load the description into |
Implements swarmio::services::discovery::Discoverable.
Definition at line 212 of file telemetry/Service.cpp.
|
inline |
Definition at line 215 of file telemetry/Service.h.
|
overridevirtual |
Delivery point of all messages.
| sender | The node that has sent the message |
| message | The message itself |
Reimplemented from swarmio::Mailbox.
Definition at line 150 of file telemetry/Service.cpp.
|
inline |
Register a new status observer.
| observer | Observer |
Definition at line 198 of file telemetry/Service.h.
|
inline |
Remove a field from the schema.
| key | Key |
Definition at line 186 of file telemetry/Service.h.
|
inline |
Remove a value from the local telemetry cache.
| key | Key |
Definition at line 155 of file telemetry/Service.h.
|
inline |
Add field to the schema.
| key | Key |
| field | Field |
Definition at line 167 of file telemetry/Service.h.
|
inline |
Add or update a value in the local telemetry cache.
| key | Key |
| value | Value |
Definition at line 144 of file telemetry/Service.h.
|
inlinestatic |
Subscribe to all named values on the remote node.
| endpoint | Endpoint to use |
| node | Remote node |
| interval | Interval |
Definition at line 109 of file telemetry/Service.h.
|
static |
Subscribe to soecific named values on the remote node.
| endpoint | Endpoint to use |
| node | Remote node |
| interval | Interval |
| keys | Keys to subscribe to |
Definition at line 11 of file telemetry/Service.cpp.
|
inline |
Unregister a status observer.
| observer | Observer |
Definition at line 209 of file telemetry/Service.h.
|
finaloverrideprotectedvirtual |
Send an update to all subscribers.
Implements swarmio::services::PeriodicService.
Definition at line 38 of file telemetry/Service.cpp.
List of observers.
Definition at line 71 of file telemetry/Service.h.
|
private |
Mutex to protect the list of observers.
Definition at line 77 of file telemetry/Service.h.
|
private |
Cached values for remote status reports.
Definition at line 83 of file telemetry/Service.h.
|
private |
Mutex to protect remote status reports.
Definition at line 89 of file telemetry/Service.h.
|
private |
Schema.
Definition at line 41 of file telemetry/Service.h.
|
private |
Mutex to protect the schema.
Definition at line 53 of file telemetry/Service.h.
|
private |
List of keys to include in the status broadcast.
Definition at line 47 of file telemetry/Service.h.
|
private |
Trackers for each remote subscription.
Definition at line 59 of file telemetry/Service.h.
|
private |
Mutex to protect the list of trackers.
Definition at line 65 of file telemetry/Service.h.
|
private |
List of published telemetry values.
Definition at line 29 of file telemetry/Service.h.
|
private |
Mutex to protect the map of values.
Definition at line 35 of file telemetry/Service.h.