|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.planx.xmlstore.routing.Space
public class Space
Represents a space (or subspace) containing nodes. The spaces are organized in a binary tree where only the leaf spaces have buckets containing nodes. The internal spaces each contain exactly two child spaces (never one).
All identifiers are transformed from the real identifier space to the "distance from the local node"-space using the XOR metric. In other words, the local node has id 0 and the ids increase as the distance from the local node increases. Note that this is a loss-free transformation in that the original id can be recovered by the XOR of the id in this space and the id of the local node in the real space.
Space is synchronized.
| Constructor Summary | |
|---|---|
Space(Node local,
Configuration conf)
Construct an empty top level space that covers the complete range of identifiers. |
|
Space(Node local,
Configuration conf,
KademliaNeighbourhoodListener listener)
Construct an empty top level space that covers the complete range of identifiers. |
|
| Method Summary | |
|---|---|
void |
addNeighbourhoodListener(NeighbourhoodListener listener)
|
List |
getAll()
Returns all nodes in the tree of spaces rooted at this space. |
List |
getClosestNodes(Identifier id)
Returns the K nodes known by this space closest to the specified id. |
List |
getNeighbourhood()
Returns all nodes in the neighbourhood of the local node. |
List |
getRefreshList()
Returns a list containing random Identifiers in bucket ranges that needs to be refreshed. |
void |
insertNode(Node newNode)
Inserts the specified node into this space. |
int |
nodeCount()
Returns the number of nodes in the range covered by this space. |
void |
removeNeighbourhoodListener(NeighbourhoodListener listener)
|
boolean |
removeNode(Node node)
Marks a node as unresponsive and removes it from the tree of spaces rooted at this space if it has been marked in this way STALE times. |
String |
toString()
For debugging purposes, returns a string containing an XML document representing the binary tree of spaces rooted at this space. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Space(Node local,
Configuration conf)
public Space(Node local,
Configuration conf,
KademliaNeighbourhoodListener listener)
local - The local nodeconf - Configuration parameterslistener - A listener for arriving nodes in the neighbourhood of the local node| Method Detail |
|---|
public void addNeighbourhoodListener(NeighbourhoodListener listener)
public void removeNeighbourhoodListener(NeighbourhoodListener listener)
public List getClosestNodes(Identifier id)
public boolean removeNode(Node node)
true if the node was actually removed.
public void insertNode(Node newNode)
public List getRefreshList()
public List getAll()
public List getNeighbourhood()
public int nodeCount()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||