planet.symphony
Class SymphonyNode

java.lang.Object
  extended byplanet.generic.commonapi.NodeImpl
      extended byplanet.symphony.SymphonyNode
All Implemented Interfaces:
Node, java.io.Serializable

public class SymphonyNode
extends NodeImpl

This node is an implementation of the Symphony overlay.

Author:
Helio Tejedor, Ruben Mondejar, Carles Pairot, Jordi Pujol
See Also:
Serialized Form

Field Summary
static int ACCEPT_CONNECT
           
static int BROADCAST
          Type value: The message with this type identifies a broadcast message.
static int CANCEL_CONNECT
           
static int CLOSE_LONG_CONNECT
           
static int CLOSE_PRED_CONNECT
           
static int CLOSE_SUCC_CONNECT
           
static int DATA
          Type value: It identifies that this message contains an application level Message.
static int GET_SUCC
           
static int JOIN_FINISHED
           
static int NEW_SUCC_IN_LIST
           
static int QUERY_CONNECT
           
static int QUERY_JOIN
          Type value: First message that is send by any node to get its inmediate successor.
static int QUERY_JOIN_SET
           
static int REFRESH
          Mode value: Defines a message's mode that requires only communication on one way.
static int REFUSE_JOIN
           
static int REPLY
          Mode value: Defines the response of a communication.
static int REQUEST
          Mode value: Defines the start of communication that requires response (REPLY).
static int SET_INFO
           
static int SET_SECTIONSIZEPRED
           
static java.lang.String[] TYPES
          This String contains a string representation of each of types and modes values of the RouteMessage.
 
Fields inherited from class planet.generic.commonapi.NodeImpl
endpoints, id, listeners, nodeHandle
 
Constructor Summary
SymphonyNode(Id id)
           
 
Method Summary
 void broadcast(java.lang.String appId, NodeHandle to, NodeHandle nextHop, Message msg)
          Initiating a Broadcast Message
 void dispatcher(RouteMessage msg)
           
 void fail()
          If supose TCP connections onto network layer, this method must informe with some type of error message to its connected nodes for broken connection.
 java.util.Hashtable getInfo()
          Returns information of the node
 NodeHandle getPred()
          Returns the NodeHandle of the present predecessor of the node
 java.util.Vector getSuccList(int max)
          Returns the successor list of the present node with max number of Ids.
 boolean isAlive()
          Informs if this node is alive.
 boolean IsStabilized()
           
 void join(Id bsId)
          The node joins in the network
 void leave()
          The node leaves the network
 java.util.Vector localLookup(Id key, int max, boolean safe)
          Returns a list of nodes that can be used as next hops on a route towards key.
 void lookup(Id key)
          Lookup of a key
 java.util.Vector neighborSet(int max)
          Obtains an unordered list of up to max nodes that are neighbors of the local node.
 void prettyPrintNode()
          Shows for System.out only the owner Id, its predecessor and successor.
 void printNode()
          Shows for System.out all information of the node, including finger table.
 boolean process(int actualStep)
          Given a time fraction, the node it can do everything what needs during this
 boolean range(NodeHandle node, Id rank, Id leftKey, Id rightKey)
          This operation provides information about ranges of keys for which the node is currently a root.
 java.util.Vector replicaSet(Id key, int maxRank)
          Returns an ordered set of nodes on which replicas of the object with this key can be stored.
 void routeData(java.lang.String appId, NodeHandle to, NodeHandle nextHop, Message msg)
          Receive's data of the application level and sends it through de network.
 java.lang.String toString()
           
 
Methods inherited from class planet.generic.commonapi.NodeImpl
addMessageListener, getId, getIdFactory, getLocalHandle, getRegisteredApplications, hasMoreMessages, nextMessage, outMessages, receive, registerApplication, removeMessageListener, send, setTimer, setTimer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REQUEST

public static final int REQUEST
Mode value: Defines the start of communication that requires response (REPLY).

See Also:
Constant Field Values

REPLY

public static final int REPLY
Mode value: Defines the response of a communication.

See Also:
Constant Field Values

REFRESH

public static final int REFRESH
Mode value: Defines a message's mode that requires only communication on one way.

See Also:
Constant Field Values

QUERY_JOIN

public static final int QUERY_JOIN
Type value: First message that is send by any node to get its inmediate successor.

See Also:
Constant Field Values

QUERY_JOIN_SET

public static final int QUERY_JOIN_SET
See Also:
Constant Field Values

SET_INFO

public static final int SET_INFO
See Also:
Constant Field Values

JOIN_FINISHED

public static final int JOIN_FINISHED
See Also:
Constant Field Values

SET_SECTIONSIZEPRED

public static final int SET_SECTIONSIZEPRED
See Also:
Constant Field Values

REFUSE_JOIN

public static final int REFUSE_JOIN
See Also:
Constant Field Values

QUERY_CONNECT

public static final int QUERY_CONNECT
See Also:
Constant Field Values

ACCEPT_CONNECT

public static final int ACCEPT_CONNECT
See Also:
Constant Field Values

CANCEL_CONNECT

public static final int CANCEL_CONNECT
See Also:
Constant Field Values

CLOSE_LONG_CONNECT

public static final int CLOSE_LONG_CONNECT
See Also:
Constant Field Values

CLOSE_PRED_CONNECT

public static final int CLOSE_PRED_CONNECT
See Also:
Constant Field Values

CLOSE_SUCC_CONNECT

public static final int CLOSE_SUCC_CONNECT
See Also:
Constant Field Values

NEW_SUCC_IN_LIST

public static final int NEW_SUCC_IN_LIST
See Also:
Constant Field Values

GET_SUCC

public static final int GET_SUCC
See Also:
Constant Field Values

BROADCAST

public static final int BROADCAST
Type value: The message with this type identifies a broadcast message.

See Also:
Constant Field Values

DATA

public static final int DATA
Type value: It identifies that this message contains an application level Message.

See Also:
Constant Field Values

TYPES

public static final java.lang.String[] TYPES
This String contains a string representation of each of types and modes values of the RouteMessage.

Constructor Detail

SymphonyNode

public SymphonyNode(Id id)
             throws InitializationException
Method Detail

getPred

public NodeHandle getPred()
Description copied from interface: Node
Returns the NodeHandle of the present predecessor of the node

Returns:
predeccesor NodeHandle of this Node

join

public void join(Id bsId)
Description copied from class: NodeImpl
The node joins in the network

Specified by:
join in interface Node
Specified by:
join in class NodeImpl

leave

public void leave()
Description copied from class: NodeImpl
The node leaves the network

Specified by:
leave in interface Node
Specified by:
leave in class NodeImpl

lookup

public void lookup(Id key)
Description copied from class: NodeImpl
Lookup of a key

Specified by:
lookup in class NodeImpl
Parameters:
key - Id

dispatcher

public void dispatcher(RouteMessage msg)

process

public boolean process(int actualStep)
Description copied from class: NodeImpl
Given a time fraction, the node it can do everything what needs during this

Specified by:
process in interface Node
Overrides:
process in class NodeImpl
Parameters:
actualStep - Actual step in simulation time.
Returns:
Always true.

getInfo

public java.util.Hashtable getInfo()
Description copied from class: NodeImpl
Returns information of the node

Specified by:
getInfo in class NodeImpl
Returns:
info Hashtable with the information

routeData

public void routeData(java.lang.String appId,
                      NodeHandle to,
                      NodeHandle nextHop,
                      Message msg)
Description copied from interface: Node
Receive's data of the application level and sends it through de network.

Parameters:
appId - String that includes the application identification.
to - Node that must receive this message. If cannot represents a real node.
nextHop - Node that must receive this message as first hop.
msg - Message to be sent. If it is null, the message must be routed.

printNode

public void printNode()
Description copied from interface: Node
Shows for System.out all information of the node, including finger table.


prettyPrintNode

public void prettyPrintNode()
Description copied from interface: Node
Shows for System.out only the owner Id, its predecessor and successor.


isAlive

public boolean isAlive()
Description copied from interface: Node
Informs if this node is alive.

Returns:
true if the node is alive. false if the node has fail or leave.

toString

public java.lang.String toString()

IsStabilized

public boolean IsStabilized()

broadcast

public void broadcast(java.lang.String appId,
                      NodeHandle to,
                      NodeHandle nextHop,
                      Message msg)
Description copied from interface: Node
Initiating a Broadcast Message

Parameters:
appId -
to -
nextHop -
msg -
Returns:
A RouteMessage with the correctly initialized values.
See Also:
Node.broadcast(java.lang.String, planet.commonapi.NodeHandle, planet.commonapi.NodeHandle, planet.commonapi.Message)

fail

public void fail()
Description copied from interface: Node
If supose TCP connections onto network layer, this method must informe with some type of error message to its connected nodes for broken connection. In other case, nothing should be required.

See Also:
Node.fail()

getSuccList

public java.util.Vector getSuccList(int max)
Description copied from interface: Node
Returns the successor list of the present node with max number of Ids.

Parameters:
max -
Returns:
See Also:
Node.getSuccList(int)

localLookup

public java.util.Vector localLookup(Id key,
                                    int max,
                                    boolean safe)
Description copied from interface: Node
Returns a list of nodes that can be used as next hops on a route towards key. If is safe, the expected fraction of faulty nodes in the list is guaranteed to be no higher than the fraction of faulty nodes in the overlay.

Parameters:
key -
max -
safe -
Returns:
See Also:
Node.localLookup(planet.commonapi.Id, int, boolean)

neighborSet

public java.util.Vector neighborSet(int max)
Description copied from interface: Node
Obtains an unordered list of up to max nodes that are neighbors of the local node.

Parameters:
max -
Returns:
See Also:
Node.neighborSet(int)

range

public boolean range(NodeHandle node,
                     Id rank,
                     Id leftKey,
                     Id rightKey)
Description copied from interface: Node
This operation provides information about ranges of keys for which the node is currently a root. Returns false if the range could not be determined, true otherwise.

It is an error to query the range of a node not present in the neighbor set.

The [leftKey,rightKey] denotes the inclusive range of key values.

Parameters:
node -
rank -
leftKey -
rightKey -
Returns:
See Also:
Node.range(planet.commonapi.NodeHandle, planet.commonapi.Id, planet.commonapi.Id, planet.commonapi.Id)

replicaSet

public java.util.Vector replicaSet(Id key,
                                   int maxRank)
Description copied from interface: Node
Returns an ordered set of nodes on which replicas of the object with this key can be stored. The maximum number of nodes is maxRank. If the implementation's maximum replica set size is lower, then its maximum replica set is returned.

Parameters:
key -
maxRank -
Returns:
See Also:
Node.replicaSet(planet.commonapi.Id, int)