FountainMasterNode Class Reference
[Fountain master and slave nodes]

The FountainMasterNode class extends the FountainNode class by adding or overloading methods to recover from tree failures and handle requests from the Fountain server. More...

#include <FountainMasterNode.h>

Inheritance diagram for FountainMasterNode:

FountainNode List of all members.

Public Member Functions

void checkConnections ()
 Handles incoming connection requests and messages on existing connections.

Private Types

typedef Loki::SmartPtr< TreeTopologyTreeTopologyPtr
 Shorthand for a TreeTopology pointer wrapped inside a SmartPtr object.

Private Member Functions

void handleJoinAsServer (ConstParseMsgPtr request, FountainWireProtPtr serverCon)
 handles a join request from the Fountain server
void handleJoin (ConstParseMsgPtr request, FountainWireProtPtr requestConnection)
int handleLostChild (const NodeID &childID)
 Handles a lost child of the master Fountain node.
void checkTree ()
 Checks the status of the tree topology.
void joinMasterNode ()
 Overloads FountainNode::joinMasterNode() method so this does nothing.
void handleLostParent (const char *message)
 Overloads FountainNode::handleLostParent() method so this does nothing.
void rebuildTree (unsigned int degree=0)
 If the Tree Topology could not be recovered from a node failure, this method will rebuild the tree from scratch.
NodeResponsePtr processRequest (FountainMessage::MessageAction action, ConstParseMsgPtr request, time_t timeout)
 Handles master Fountain node specific requests.
 FountainMasterNode (const NodeID &myID)
 Default constructor, private since we're using a singleton design pattern.
 FountainMasterNode (const FountainMasterNode &rhs)
 Private copy constructor since we're using a singleton design pattern.
FountainMasterNodeoperator= (const FountainMasterNode &rhs)
 Private assignment operator since we're using a singleton design pattern.
 ~FountainMasterNode ()
 Private destructor since we're using a singleton design pattern.

Private Attributes

TreeTopologyPtr treeTopologyPtr_
std::string myActor_

Friends

class FountainNodeCreator

Detailed Description

The FountainMasterNode class extends the FountainNode class by adding or overloading methods to recover from tree failures and handle requests from the Fountain server.

This is a singleton class since it really does not make sense for any application to maintain multiple FountainMasterNode objects. This object is instantiated by the masterNode.cpp driver code on and it typically will run on the head node of a cluster. It extends the FountainNode class by adding methods to handle lost parent and child nodes, which are reported by the other nodes in the Fountain tree topology.


Member Function Documentation

void FountainMasterNode::checkConnections  )  [virtual]
 

Handles incoming connection requests and messages on existing connections.

Todo:
Devise a method to effectively make each of these handling functions throw an exception. sjm 2-9-2006

Reimplemented from FountainNode.

void FountainMasterNode::checkTree  )  [private]
 

Checks the status of the tree topology.

This method checks the status of the tree topology and attempts to recover or rebuilt it if any nodes in the tree are lost

Exceptions:
FountainException if the tree topology could not be recoveries and it had to be rebuilt

void FountainMasterNode::handleJoin ConstParseMsgPtr  request,
FountainWireProtPtr  requestConnection
[private]
 

Handles join requests from an incoming connection.

Parameters:
request the request message from the node attempting to join us
requestConnection the connection that sent the join request
Precondition:
valid request and requestConnection
Postcondition:
Accept the request as a node in the tree topology
The master Fountain node join algorithm matches the following requirements in the join request message before accepting the slave Fountain node into the tree topology:

  1. Their Version data element matches ours
  2. They have a valid actor attribute
  3. If restrictActors is true, we need to only accept actors equal to us
  4. If restrictHostnames is true, we lookup their hostname to make sure it is valid and other Fountain nodes can connect to them

Reimplemented from FountainNode.

void FountainMasterNode::handleJoinAsServer ConstParseMsgPtr  request,
FountainWireProtPtr  serverCon
[private]
 

handles a join request from the Fountain server

A Fountain server process will attempt to join us, this function will either accept the request to join, or reject it if we already have a Fountain server connection.

Exceptions:
FountainException if there is an error when parsing the request

int FountainMasterNode::handleLostChild const NodeID childID  )  [private, virtual]
 

Handles a lost child of the master Fountain node.

Handles a lost child Fountain node.

Parameters:
childID The NodeID of the lost child Fountain node
Return values:
int SUCCESS if the lost child node should be removed from the children vector, FAILURE if the lost child node should NOT be removed from the children vector
Exceptions:
FountainException if the lost child node could not be reported to the master node

Reimplemented from FountainNode.

void FountainMasterNode::handleLostParent const char *  message  )  [inline, private, virtual]
 

Overloads FountainNode::handleLostParent() method so this does nothing.

Handles a lost parent Fountain node.

Parameters:
message A c-string to add as the Message element in the request to the master Fountain node
Exceptions:
FountainException if handling the lost parent Fountain node was not successful

Reimplemented from FountainNode.

void FountainMasterNode::joinMasterNode  )  [inline, private, virtual]
 

Overloads FountainNode::joinMasterNode() method so this does nothing.

Joins the master Fountain Node using the hostname and port specified in the FountainNode constructor.

Exceptions:
FountainException if we could not join the master Fountain node

Reimplemented from FountainNode.

NodeResponsePtr FountainMasterNode::processRequest FountainMessage::MessageAction  action,
ConstParseMsgPtr  request,
time_t  timeout
[private, virtual]
 

Handles master Fountain node specific requests.

Process and respond to a request message from our parent.

Parameters:
[in] action The message action
[in] request The request message from our parent
[in] timeout The number of seconds to wait for a response from each child node
Return values:
NodeResponsePtr The response message to send back to our parent
Precondition:
request != NULL

Reimplemented from FountainNode.


Member Data Documentation

std::string FountainMasterNode::myActor_ [private]
 

The userid that launched us

TreeTopologyPtr FountainMasterNode::treeTopologyPtr_ [private]
 

Pointer to our tree object


The documentation for this class was generated from the following files:
Generated on Wed Mar 8 14:43:32 2006 for Fountain by  doxygen 1.4.6