Derecho-Project / derecho

The main code repository for the Derecho project.
BSD 3-Clause "New" or "Revised" License
186 stars 47 forks source link

Enable external client notifications #239

Closed etremel closed 2 years ago

etremel commented 2 years ago

Weijia and I have finished testing the changes in the client_callbacks branch and it seems stable enough to merge into master. I'm just creating this pull request to make some record of the merge since there are several new features being introduced.

Derecho subgroups can now send notifications to their external clients if they inherit the class NotificationSupport. This will cause external clients to also inherit NotificationSupport, and gain a P2P-callable method named notify(). The Derecho member can then initiate a P2P send (of the notify method) to an external client using an ExternalClientCallback object, which can be retrieved using the new get_client_callback() method of Group. The notification's argument is an object of type NotificationMessage, which is a very simple raw byte array with a single uint64_t in its header that can be used to identify the type of message; any meaningful data included in the notification must be serialized into the NotificationMessage's byte array.

The new unit test persistence_notification_test.cpp demonstrates how to use external notifications to notify clients when a particular update has finished persisting in the Derecho group.