|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DKSInterface
DKSInterface represents a basic routing interface which essentially lets DKS nodes join and leave the system. It also provides a basic operation to find the node responsible for a given identifier Note that keys are represented by long (64 bit) integers in this interface. It is up to other services using this interface to translate application specific keys to this representation.
| Method Summary | |
|---|---|
boolean |
addMsgHandler(DKSMessage msg,
java.lang.Object handlerObject,
java.lang.String methodName)
Registers a handler for a DKSMessage. |
void |
broadcast(DKSObject message)
Broadcasts the given message. |
void |
broadcastRestricted(DKSObject message,
long startId,
long endId)
Broadcasts the given message. |
void |
create()
Called by the first node in a ring, this will create a new DKS network containing one node only |
DKSRef |
findResponsible(long identifier)
Will find the DKS node that is responsible for the given identifier |
DKSRef |
getDKSRef()
Returns the DKSRef associated to this DKS node |
java.lang.String |
getDKSURL()
Returns the DKSURL (stringified DKSRef) used by this DKS node |
void |
join(DKSRef existingnodeAddress)
Adds a new node to the network managed by the local DKS implementation. |
void |
leave()
Disconnect the local node from the network. |
void |
logLevel(int level)
Set the logging level |
DKSObject |
route(long identifier,
DKSObject payload)
Will route a message the DKS node that is responsible for the given identifier, and call routeCallback() at that node and give it the payload, upon which the responsible node will respond with a payload which is returned to the caller |
void |
routeAsync(long identifier,
DKSObject payload)
Will route a message the DKS node that is responsible for the given identifier, and call routeCallbackAsync() at that node and give it the payload, upon which the responsible node will respond with a payload which is returned to the caller |
void |
routeAsyncFrom(long identifier,
DKSObject payload,
DKSRef firstNode)
Will route a message, starting at firstNode, the DKS node that is responsible for the given identifier, and call routeCallbackAsync() at that node and give it the payload, upon which the responsible node will respond with a payload which is returned to the caller. |
void |
send(DKSRef target,
DKSMessage message)
Sends a DKSMessage to a DKS node |
void |
unregisterNode()
Every object implementing this interface gets registered in a ConnectionManager, this method this method unregisters the object in the ConnectionManager. |
| Method Detail |
|---|
void join(DKSRef existingnodeAddress)
throws DKSTooManyRestartJoins,
DKSIdentifierAlreadyTaken,
DKSRefNoResponse
nodeId - The unique DKS node identifier (key) for the new node.nodeAddress - The location of the new node on the physical underlying
network.
DKSTooManyRestartJoins
DKSIdentifierAlreadyTaken
DKSRefNoResponsevoid create()
existingnodeAddress - DKSOverlayAddressvoid logLevel(int level)
level - int, 0 means no logging, 1 means debug prints, 2 means XML dumpsvoid leave()
DKSRef findResponsible(long identifier)
identifier - whose responsible node is being queried for
DKSObject route(long identifier,
DKSObject payload)
identifier - whose responsible node being routed topayload - to be sent to the responsible node
DKSAppInterface
void routeAsync(long identifier,
DKSObject payload)
identifier - whose responsible node being routed topayload - to be sent to the responsible nodeDKSAppInterface
void routeAsyncFrom(long identifier,
DKSObject payload,
DKSRef firstNode)
identifier - longpayload - DKSObjectfirstNode - DKSRefvoid broadcast(DKSObject message)
void broadcastRestricted(DKSObject message,
long startId,
long endId)
java.lang.String getDKSURL()
DKSRefDKSRef getDKSRef()
DKSRefvoid unregisterNode()
void send(DKSRef target,
DKSMessage message)
target - a DKSRef to a node in the systemmessage - a DKSMessage
boolean addMsgHandler(DKSMessage msg,
java.lang.Object handlerObject,
java.lang.String methodName)
msg - Some object which is a subclass of DKSMessagehandlerObject - Object whose method will be invoked upon receipt of a message of type DKSMessagemethodName - full case sensitive of the method to be invoked(without paranthesis). The method has a predefined signature
as described in the following example.
Example: if the method name is "handleStore", there should a method in handlerObject with the signature
public void handleStore(DKSRef sender, msgClass msg)msg.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||