Project

General

Profile

Task #1244

Updated by Alex Afanasyev over 10 years ago

Implement a publisher of [[FaceMgmt#Face-Status-Change-Notification|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) 
     } 
    
     enum FaceEventKind 
    
     struct FaceEventNotification 
     { 
         FaceEventKind 
         FaceId 
         Uri 
         FaceFlags 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` for face status change), and pass wireEncode'd of it to `NotificationStream::postNotification` 
 4. `NotificationStream::postNotification` 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. 

Back