Task #1244
Updated by Alex Afanasyev over 11 years ago
Implement a publisher of [[FaceStatus#Monitor-face-status|face status change]] [[Notification|notification stream]].
Initial design is below.
Assignee is permitted to make reasonable changes to the design.
## API
interface NotificationStream
{
__construct(AppFace, Name prefix)
template<typename Notification>
void postNotification(Notification notification) postEvent(Block event)
}
enum FaceEventKind
struct FaceEventNotification FaceEvent
{
FaceId
Uri
FaceEventKind
Block wireEncode()
wireDecode(Block)
}
## Operations
1. Caller creates a `NotificationStream` instance, which is the publisher of a notification stream.
2. Caller constructs a `Notification` class (`FaceEventNotification` (`FaceEvent` for face status change), and pass wireEncode'd of it to `NotificationStream::postNotification` `NotificationStream::postEvent`
4. `NotificationStream::postNotification` `NotificationStream::postEvent` further encloses the payload into a Data packet, and puts the Data packet through the AppFace.
5. `AppFace::put` will cause InternalFace to receive this Data packet. Since InternalFace is trusted, this *unsolicited* Data packet will be placed into the ContentStore, waiting for client to retrieve.
Note:
* `NotificationStream` does not store Notification, payload, or Data packet. It generates Data packet and puts to ContentStore, and then relies on ContentStore to keep it.