|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplanet.generic.commonapi.EndPointImpl
Interface which represents a node in a peer-to-peer system, regardless of the underlying protocol. This represents the *local* node, upon which applications can call methods.
Nested Class Summary | |
class |
EndPointImpl.MessageScheduler
Implements an scheduler for sent messages to this application with a specified delay. |
Constructor Summary | |
EndPointImpl()
Builds a no initialized EndPoint. |
Method Summary | |
void |
broadcast(Id key,
Message message)
Sends a broadcast message to the network. |
void |
byStep()
An upcall to inform to the top Application for a new step. |
boolean |
forward(RouteMessage message)
Deliver only the content Message in RouteMessage to the application and returns if this message must be forward. |
java.util.Set |
getAllLinks()
Returns all node links. |
Application |
getApplication()
Gets the associated Application. |
java.lang.String |
getApplicationId()
Returns the identification of the related Application |
Id |
getId()
Returns the identification of the related Node |
NodeHandle |
getLocalNodeHandle()
Returns a handle to the local node below this endpoint. |
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. |
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 |
route(Id id,
Message message,
NodeHandle hint)
This method makes an attempt to route the message to the root of the given id. |
void |
scheduleMessage(RouteMessage message,
long delay)
Schedules a message to be delivered to this application after the provided number of milliseconds. |
EndPoint |
setValues(Application app,
Node node)
Sets the initial values for this EndPoint. |
java.lang.String |
toString()
Shows a String representatio of this EndPoint |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public EndPointImpl()
Method Detail |
public void byStep()
byStep
in interface EndPoint
public void route(Id id, Message message, NodeHandle hint)
route
in interface EndPoint
id
- The destination Id of the message.message
- The message to deliverhint
- The destination desired known node. If unknown node, it may be null.public void broadcast(Id key, Message message)
broadcast
in interface EndPoint
key
- The destination Id of the message.message
- The message to deliverpublic NodeHandle getLocalNodeHandle()
getLocalNodeHandle
in interface EndPoint
public void scheduleMessage(RouteMessage message, long delay)
scheduleMessage
in interface EndPoint
message
- The message to be delivereddelay
- The number of milliseconds to wait before delivering the messagepublic boolean forward(RouteMessage message)
---------------------------------------------------------------- | RouteMessage | | ---------------------------------------------- | | | DataMessage | | | Route | ---------- ------------------------------ | | | Message | |Id (Key)| |Specific Application Message| | | | Header | ---------- ------------------------------ | | | ---------------------------------------------- | ----------------------------------------------------------------
forward
in interface EndPoint
message
- RouteMessage to be forwarding.
EndPoint.forward(planet.commonapi.RouteMessage)
public java.lang.String getApplicationId()
getApplicationId
in interface EndPoint
EndPoint.getApplicationId()
public Application getApplication()
getApplication
in interface EndPoint
public Id getId()
getId
in interface EndPoint
EndPoint.getId()
public java.util.Vector replicaSet(Id key, int maxRank)
EndPoint
replicaSet
in interface EndPoint
key
- Key from which obtain the replica set.maxRank
- Number of nodes in replica set.
Returns the replica node set.
The number of successor list is defined in the context.
public java.util.Vector localLookup(Id key, int max, boolean safe)
localLookup
in interface EndPoint
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)
neighborSet
in interface EndPoint
max
- Maximum of nodes to return.
public boolean range(NodeHandle node, Id rank, Id leftKey, Id rightKey)
EndPoint
range
in interface EndPoint
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.
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.
public java.lang.String toString()
Object.toString()
public java.util.Set getAllLinks()
getAllLinks
in interface EndPoint
EndPoint.getAllLinks()
public EndPoint setValues(Application app, Node node)
setValues
in interface EndPoint
app
- Uplying application.node
- Underlaying node.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |