|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface which represents a node in a peer-to-peer system, regardless of the underlying protocol. This represents a factory, in a sense, that will give a application an Endpoint which it can use to send and receive messages.
Method Summary | |
void |
broadcast(java.lang.String appId,
NodeHandle to,
NodeHandle nextHop,
Message msg)
Initiating a Broadcast Message |
void |
buildEdges(java.lang.String resultName,
java.util.Collection edgeCollection,
ResultsConstraint constraint)
This method is a callback method used to collect all edges of a graph according to resultName format. |
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.Set |
getAllLinks()
Gets all node connections to other nodes as its NodeHandles. |
NodeHandle |
getClosestNodeHandle(Id id)
Returns the NodeHandle closest to id. |
Id |
getId()
Returns the Id of this node |
NodeHandle |
getLocalHandle()
Returns the NodeHandle for the actual Node. |
NodeHandle |
getPred()
Returns the NodeHandle of the present predecessor of the node |
EndPoint |
getRegisteredApplication(java.lang.String instanceName)
Get the registered application by the instanceName name. |
Application[] |
getRegisteredApplications()
Returns all references of the applications that mantains this node. |
NodeHandle |
getSucc()
Returns the NodeHandle of the present successor 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 |
isLocalMessage(RouteMessage msg)
The isLocalMessage's method is an extension method for commonapi specs. |
void |
join(NodeHandle boot)
This Node is joined by another node identified by boot to the actual network. |
void |
leave()
This method permits to the actual node to leave 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. |
java.util.Vector |
neighborSet(int max)
Obtains an unordered list of up to max nodes that are neighbors of the local node. |
Queue |
outMessages()
Returns the outgoing queue with message to be send. |
boolean |
playsGoodRole()
The playsGoodRole's method is an extension method for commonapi specs. |
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)
It permits to the node to send messages, run stabilization, etc. |
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. |
void |
receive(RouteMessage msg)
This method is invoked to send a message msg to the actual Node (another ----> me). |
EndPoint |
registerApplication(Application app,
java.lang.String instance)
This returns a VirtualizedNode specific to the given application and instance name to the application, which the application can then use in order to send and receive messages. |
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. |
void |
send(RouteMessage msg)
This method is invoked to send a message msg to another Node (me ---> another). |
void |
setGoodRole(boolean role)
The setGoodRole's method is an extension method for commonapi specs. |
void |
setTimer(TimerTask task,
long firstTime)
Sets a new task to make only once time. |
void |
setTimer(TimerTask task,
long firstTime,
long period)
Sets a new task to make periodicly at period time. |
Node |
setValues(Id newId)
Sets the new Id for this Node. |
Method Detail |
public EndPoint registerApplication(Application app, java.lang.String instance)
app
- The Applicationinstance
- An identifier for a given instance
public EndPoint getRegisteredApplication(java.lang.String instanceName)
instanceName
- Name of the registered application.
public Application[] getRegisteredApplications()
public Id getId()
public void routeData(java.lang.String appId, NodeHandle to, NodeHandle nextHop, Message msg)
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.public void join(NodeHandle boot)
boot
- NodeHandle of Node to join to the actual network.public void leave()
public void fail()
public boolean process(int actualStep)
actualStep
- Actual step to simulate
public void receive(RouteMessage msg) throws QueueFull
msg
- Message to be received for the actual Node.
QueueFull
- if the incoming queue of the actual Node is full.public void send(RouteMessage msg) throws QueueFull
msg
- Message to be received for the remote Node.
QueueFull
- if the outgoing queue of the actual Node is full.public Queue outMessages()
public void printNode()
public void prettyPrintNode()
public void broadcast(java.lang.String appId, NodeHandle to, NodeHandle nextHop, Message msg)
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.
If it is null, the message must be routed.public NodeHandle getLocalHandle()
public NodeHandle getPred()
public NodeHandle getSucc()
public boolean isAlive()
public java.util.Vector getSuccList(int max)
max
- number of the elements (NodeHandle's) to return
public boolean playsGoodRole()
public void setGoodRole(boolean role)
role
- public boolean isLocalMessage(RouteMessage msg)
BehavioursPool
public void setTimer(TimerTask task, long firstTime)
task
- Job to do at the unique activation.firstTime
- First moment at which the task will be activated, in
absolute representation, not relative for the actual time.public void setTimer(TimerTask task, long firstTime, long period)
task
- Job to do at each activation.firstTime
- First moment at which the task will be activated,
in absolute representation, not relative for the actual timeperiod
- Number of steps or millis of the period.public java.util.Vector localLookup(Id key, int max, boolean safe)
key
- Target keymax
- Number of next hops.safe
- If true, the expected fraction of faulty nodes are the same
of the nodes in the overlay.
public java.util.Vector neighborSet(int max)
max
- Maximum of nodes to return.
public java.util.Vector replicaSet(Id key, int maxRank)
key
- Id for which we find the replica set.maxRank
- Maximum number of members in replica set.
public boolean range(NodeHandle node, Id rank, Id leftKey, Id rightKey)
node
- Node that is currently a root of some range of keys.rank
- Number of keys that is root the node (rank=rightKey-leftKey).leftKey
- The value that appears in the invokation is the candidate left
key of the range. It may be modified to reflect the correct left margin
once invokation has finished.rightKey
- Shows once the invokation has finished the left margin of
the range.
public void buildEdges(java.lang.String resultName, java.util.Collection edgeCollection, ResultsConstraint constraint)
resultName
- Result type name to use.edgeCollection
- Edge collection where to put in all produced ResultEdges.constraint
- ResultsConstraint for edge selectionpublic NodeHandle getClosestNodeHandle(Id id)
id
- Id to find.
public java.util.Set getAllLinks()
public Node setValues(Id newId) throws InitializationException
newId
- The new Id
InitializationException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |