|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Network
This interface abstacts any ring or network of Nodes. It pretends contain all Nodes in the Network and allow to operate with the Nodes with transparent manner.
Method Summary | |
---|---|
boolean |
existNodeWithId(Id id)
Inform if exist on the network one node with Id id. |
void |
failNodes(Id[] nodes)
nodes shows all nodes Id that have failed. |
int |
getProximity(Id nodeA,
Id nodeB)
Evaluates the proximity between the two nodes. |
Application |
getRandomApplication(java.lang.String appId)
Gets a reference of some application on any node of the network. |
Node |
getRandomNode(java.util.Random r)
Returns a randomly selected node of actual network. |
int |
getSimulatedSteps()
Gets the actual number of simulated steps. |
java.lang.String |
getTopology()
Returns the topology of the actual network. |
java.util.Iterator |
iterator()
Gets an Iterator to get all nodes. |
void |
joinNode(Node node)
Joins the node to the ring. |
void |
joinNode(Node node,
Id bootstrap)
Network joins a node with specified bootstrap. |
int |
joinNodes(int size)
Generates size Nodes and joins them to the ring. |
int |
joinNodes(int size,
Id[] bootstrap)
Generates size new Nodes joins them by any of the bootstraps. |
void |
leaveNodes(Id[] nodes)
Leave the ring the nodes which his Id appears in the array nodes. |
void |
prettyPrintNodes()
Shows for each node, its Id, predecessor and successor. |
void |
printNodes()
Shows for System.out all information of all nodes, including its finger table. |
int |
registerApplication(Id[] nodes)
Register to all Nodes whose Id appears in array Ids of nodes the Application specified at properties file. |
void |
registerApplicationAll()
Register to all Nodes in this network the Applicaton specified at properties file. |
void |
registerApplicationRandom(int nodes)
Register the Application specified at properties file radomly to a maximum number of Nodes specified by nodes. |
int |
run(int steps)
Runs the process to simulate a total number of steps. |
boolean |
simulate()
Runs the process to simulate one time step. |
int |
size()
Returns the number of Nodes that contains the actual network. |
int |
stabilize()
Runs the process of stabilization while the network not has been stabilized. |
Method Detail |
---|
void joinNode(Node node) throws InitializationException
node
- Node to join to the ring.
InitializationException
void joinNode(Node node, Id bootstrap) throws InitializationException
node
- Node to join to the network.bootstrap
- Node that joins the node.
InitializationException
- if occurs any problem during the join.int joinNodes(int size) throws InitializationException
size
- Number of Nodes to join to the ring.
InitializationException
int joinNodes(int size, Id[] bootstrap) throws InitializationException
size
- Number of nodes to joins to the network.bootstrap
- Array of Ids to use as bootstrap. The implementation only
must ensure the use of them, or the maximum of them if the number of nodes
to join is smaller than bootstrap.length.
InitializationException
void leaveNodes(Id[] nodes) throws InitializationException
nodes
- Node's Ids that must leave the ring.
InitializationException
void failNodes(Id[] nodes) throws InitializationException
nodes
- Node's Ids that must leave the ring.
InitializationException
void registerApplicationAll() throws InitializationException
InitializationException
Application
,
Node
int registerApplication(Id[] nodes) throws InitializationException
nodes
- Ids of Nodes that must be registered the Application.
InitializationException
Node
,
Id
void registerApplicationRandom(int nodes) throws InitializationException
nodes
- Number of Nodes to be register the Application.
InitializationException
Node
,
Id
java.lang.String getTopology()
int size()
void printNodes()
void prettyPrintNodes()
int stabilize()
boolean simulate()
int run(int steps)
for (int i=0; i < steps; i++) { simulate(); }
steps
- Number of steps to simulate.
Node getRandomNode(java.util.Random r)
r
- Generator of random numbers.
boolean existNodeWithId(Id id)
id
- Id of the node to be search.
Application getRandomApplication(java.lang.String appId)
appId
- Application identification for searching it.
java.util.Iterator iterator()
int getSimulatedSteps()
int getProximity(Id nodeA, Id nodeB)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |