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)
void postEvent(Block event) sendNotification(Block notification)
}
enum FaceEventKind
struct FaceEvent FaceEventNotification
{
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 (`FaceEvent` (`FaceEventNotification` for face status change), and pass wireEncode'd of it to `NotificationStream::postEvent` `NotificationStream::sendNotification`
4. `NotificationStream::postEvent` `NotificationStream::sendNotification` 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.