gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] storm/doc/pegboard/storm_with_tapestry--hemppah...


From: Hermanni Hyytiälä
Subject: [Gzz-commits] storm/doc/pegboard/storm_with_tapestry--hemppah...
Date: Mon, 07 Jul 2003 03:38:04 -0400

CVSROOT:        /cvsroot/storm
Module name:    storm
Branch:         
Changes by:     Hermanni Hyytiälä <address@hidden>      03/07/07 03:38:04

Modified files:
        doc/pegboard/storm_with_tapestry--hemppah: peg.rst 

Log message:
        started pseudo code

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/doc/pegboard/storm_with_tapestry--hemppah/peg.rst.diff?tr1=1.4&tr2=1.5&r1=text&r2=text

Patches:
Index: storm/doc/pegboard/storm_with_tapestry--hemppah/peg.rst
diff -u storm/doc/pegboard/storm_with_tapestry--hemppah/peg.rst:1.4 
storm/doc/pegboard/storm_with_tapestry--hemppah/peg.rst:1.5
--- storm/doc/pegboard/storm_with_tapestry--hemppah/peg.rst:1.4 Fri Jul  4 
08:25:19 2003
+++ storm/doc/pegboard/storm_with_tapestry--hemppah/peg.rst     Mon Jul  7 
03:38:04 2003
@@ -5,8 +5,8 @@
 
 :Authors:  Hermanni Hyytiälä
 :Date-Created: 2003-07-03
-:Last-Modified: $Date: 2003/07/04 12:25:19 $
-:Revision: $Revision: 1.4 $
+:Last-Modified: $Date: 2003/07/07 07:38:04 $
+:Revision: $Revision: 1.5 $
 :Status:   Incomplete
 
 .. :Stakeholders:
@@ -152,19 +152,135 @@
 - For finding Storm blocks in a Tapestry overlay, we must create:
 
 
-   - BlockIDTag class for Storm blocks' IDs (ostore.tapestry.api.TapestryTag)
+   - BlockIDTag class for Storm blocks' IDs (implements 
+     ostore.tapestry.api.TapestryTag)
 
    - BlockIDQuery (implements ostore.tapestry.api.TapestryQuery) class is 
      used in a StormLocateMsg class (and in 
ostore.tapestry.api.TapestryLocateMsg)
      to find objects identified by a BlockIDTag
      
-   - StormLocateMsg class (extends ostore.tapestry.api.TapestryLocateMsg)
+   - StormQueryMsg class (extends ostore.tapestry.api.TapestryLocateMsg)
+   
+   - StormResponseMsg class
  
 - For interacting Storm's storage model with Tapestry:
 
    - StormTapestryManager class which
      - registers Storm to handle Storm-related Tapestry events
      - dispatches and handles Storm-related Tapestry events
+     
+     
+ PSEUDOCODE for Storm
+
+       class StormTapestryManager implements EventHandlerIF {
+       
+               // dispatcher which dispatch all items
+               // to target peer
+               method dispatch (QueueElementIF item) {
+                       //try do dispatch an item
+                       try {
+                               classifier.dispatch(item);
+                       } catch (expection) {
+                               error("Could not dispatch item!")
+                       }
+               }
+
+               // general initialization method
+               // that handles subscribes this stage
+               // to listen certain events and messages
+               method init (ConfigDataIF config) {
+ 
+               // find our NodeId 
+               self_node_id = new NodeId 
+               
+               // initialize the appropriate
+               // instance of the Classifier. The Classifier handles the 
+               // publish/subscribe mechanism used for
+               // event dispatch between stages.
+               
+               classifier = Classifier.getClassifier(self_node_id = new NodeId)
+               
+               // create peer ID based on peer's public key
+                _peer = new SHA1Hash (pkey);
+                
+                // the *events* which we want to listen
+
+                array event_types = {
+                "seda.sandStorm.api.StormFooSignal1",
+                "seda.sandStorm.api.StormFooSignal2"            
+               }
+               
+               for (From i = 0 To numberOf(event_types)) {
+                       classifier.subscribe (event_type[i])
+                }
+               
+               // the *messages* we want receive through Tapestry
+
+               array message_types = {
+               "ostore.apps.test.StormQueryMsg",
+               "ostore.apps.test.StormResponseMsg"
+               }
+               
+               for (From i = 0 To numberOf(message_types)) {
+           
+                  // First, register messages we intend to
+                  // receive
+                  
+                  TypeTable.register_type(messages_types[i])
+                  
+                  // Second, we require that inbound field is
+                  // set to true.  Otherwise, we will see the messages that we
+                  // send as well 
+
+                  classifier.subscribe (message_type[i], verifyInbound);
+               }
+ 
+               }
+               
+               // handles *all* events which stage is listening
+                method handleEvents(QueueElementIF array items) 
+                throws EventHandlerException {
+                
+                for (from i=0 to length(items)
+                       handleEvent(items[i])                   
+                }
+               
+               // handles single event for this stage. handleEvents
+               // method gives an item this method
+               method handleEvent(QueueElementIF item) {
+               
+                       if (item instanceof StormQueryMsg) {
+                               handleStormQueryMsg(item)
+
+                       } else if (item instanceof StormResponseMsg) {
+                               handleStormResponseMsg(item)
+                       } else {
+                               handleOtherMsg(item)            
+                       }
+                               
+               }
+               
+               // handles a certain type of event(StormQueryMsg)
+               method handleStormQueryMsg(item){
+                       results = performLocalSearch()
+                       dispatch(results)               
+               }
+               
+               // handles a certain type of event(StormResponseMsg)
+               method handleStormResponseMsg(item){
+                       response = createResponse()
+                       dispatch(response)              
+               }
+               
+               // createa a Storm query to a network
+               // Query tag is Storm block's GUID
+               method query(){
+                       blockTag = new BlockIDTag(blockGUID)
+                       q = new StormQuery()
+                       queryMsg=  new StormQueryMsg(blockTag, q)
+                       dispatch(queryMsg)
+               }
+    }
     
 .. more to come
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]