Project

General

Profile

Task #1244

Updated by Alex Afanasyev over 10 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 Notification 
     { 
         // encode as Notification payload 
         Block wireEncode() 
     } 
    
     interface NotificationStream 
     { 
         __construct(AppFace, Name prefix) 
         void sendNotification(Block notification) sendNotification(Notification) 
     } 
    
     enum FaceEventKind 
    
     struct FaceEventNotification : Notification 
     { 
         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` `Notification`-derived class (`FaceEventNotification` for face status change), and pass wireEncode'd of it to `NotificationStream::sendNotification` 
 3. `Notification::wireEncode` returns the Block for notification payload. 
 4. `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. 

Back