00001 /* ex: set tabstop=4 expandtab: */ 00002 /* */ 00003 /* (c) 2004-2006 Iowa State University */ 00004 /* see the LICENSE file in the top level directory */ 00005 /* */ 00006 /* $Header: /afs/scl/project/cvsroot/fountain/source/nodes/FountainMasterNode.h,v 1.28 2006/03/05 22:05:17 samm Exp $ */ 00013 #ifndef FOUNTAIN_MASTER_NODE_H__ 00014 #define FOUNTAIN_MASTER_NODE_H__ 00015 00016 #include "define.h" 00017 #include "TreeTopology.h" 00018 #include "FountainWireProt.h" 00019 #include "FountainNode.h" 00020 #include "LokiInclude.h" 00021 #include <string> 00022 #include <sys/types.h> //for time_t 00023 00035 class FountainMasterNode : public FountainNode { 00036 private: 00041 typedef Loki::SmartPtr<TreeTopology> TreeTopologyPtr; 00042 00046 TreeTopologyPtr treeTopologyPtr_; 00047 00055 void handleJoinAsServer(ConstParseMsgPtr request, FountainWireProtPtr serverCon); 00056 00069 void handleJoin(ConstParseMsgPtr request, FountainWireProtPtr requestConnection); 00070 00075 int handleLostChild(const NodeID& childID); 00076 00083 void checkTree(); 00084 00089 void joinMasterNode() { return; } 00090 00095 void handleLostParent(const char* message) { if (message) {} return; } 00096 00100 void rebuildTree(unsigned int degree=0); 00101 00106 NodeResponsePtr processRequest(FountainMessage::MessageAction action, ConstParseMsgPtr request, time_t timeout); 00107 00111 FountainMasterNode(const NodeID& myID); 00112 00116 FountainMasterNode(const FountainMasterNode& rhs); 00117 00121 FountainMasterNode& operator=(const FountainMasterNode& rhs); 00122 00126 ~FountainMasterNode() {} 00127 00131 std::string myActor_; 00132 00133 //this class has to be friends of us since they do the actual object instantiation 00134 template <typename T> friend class Loki::CreateUsingNew; 00135 template <typename T> friend class FountainNodeCreator; 00136 00137 public: 00141 void checkConnections(); 00142 00143 }; 00144 00150 typedef Loki::SingletonHolder<FountainMasterNode, FountainNodeCreator> SingleFountainMasterNode; 00151 00152 #endif
1.4.6