|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.kth.dks.dks_dht.DKSDHTImpl
public class DKSDHTImpl
| Field Summary | |
|---|---|
DKSImpl |
myDKSImpl
|
| Constructor Summary | |
|---|---|
DKSDHTImpl(ConnectionManager cm,
DKSOverlayAddress over)
|
|
DKSDHTImpl(ConnectionManager cm,
DKSOverlayAddress over,
java.lang.Class ldht)
|
|
DKSDHTImpl(ConnectionManager cm,
DKSOverlayAddress over,
DKSDHTCallback cb)
cb is the callback object |
|
DKSDHTImpl(ConnectionManager cm,
long nodeId,
java.net.URL nodeAddress)
|
|
| Method Summary | |
|---|---|
boolean |
addMsgHandler(DKSMessage msg,
java.lang.Object handlerObject,
java.lang.String methodName)
Registers a handler for a DKSMessage. |
void |
addToBinding(long key,
DKSObject value)
Value is added to the list of bindings associated with key. |
AsyncOperation[] |
addToBindingAsync(long key,
DKSObject value)
|
void |
broadcast(DKSObject message)
Broadcast a message to all nodes |
void |
broadcastCallback(DKSObject payload)
This callback routine is called when the node recieves a broadcast message. |
void |
broadcastRestricted(DKSObject message,
long startId,
long endId)
Broadcasts to nodes with identifiers within the rand startId and endId [] |
void |
changeBinding(long key,
DKSObject oldValue,
DKSObject newValue)
All ocurrences of oldValue in the bindings associated with key are replaced by newValue. |
void |
create()
Called by the first node in a ring, this will create a new DKS network containing one node only |
static DKSDHTImpl |
createDKSDiskDHT(ConnectionManager cm,
DKSOverlayAddress over)
|
void |
failCallback(DKSRef failed,
DKSRef failedPred)
This callback routine is called at the successor of a filed node, when it detects its predecessor has failed. |
DKSRef |
findResponsible(long id)
Will find the DKS node that is responsible for the given identifier |
DKSDHTImpl |
getDHT()
Internal function to return the underlying DHT. |
DKSMarshal |
getDKSMarshal()
end of interfaces |
DKSRef |
getDKSRef()
Returns the DKSRef associated to this DKS node |
java.lang.String |
getDKSURL()
Returns the DKSURL (stringified DKSRef) used by this DKS node |
long |
getKeyRange()
|
int |
getMultipleLookupCount()
Gets the number of concurrent lookups made (default 2), if >=1 then several lookups are made at the same time to different replicas to increase the fault-tolerance and the response time |
long |
getMyId()
|
long |
getPredecessorId()
|
int |
getReplicationDegree()
Gets the number of times each item is replicated in the system (default 2) Postcondition: Return value must be >=1 and must divide getKeyRange() |
DHTStatistics |
getStatistics()
|
DHTStorage[] |
getStorage()
|
void |
join(DKSRef existingnodeAddress)
Adds a new node to the network managed by the local DKS implementation. |
void |
join(long existingnodeId,
java.net.URL existingnodeAddress)
should be deprecated |
void |
joinCallback(DKSRef pred,
DKSRef succ)
This callback routine is called at the joining node, when the node is about to join INVARIANT: this method must make a callback to DKSCallbacks.joinCallbackReturn |
void |
leave()
Disconnect the local node from the network. |
void |
leaveCallback(DKSRef pred,
DKSRef succ)
This callback routine is called at the leaving node, when the node is about to leave INVARIANT: this method must make a callback to DKSCallbacks.joinCallbackReturn |
void |
logLevel(int level)
Set the logging level |
DKSObject[] |
lookupBinding(long key)
Returns the list of bindings associated with key. |
DKSObject[] |
lookupBinding(long minKey,
long maxKey)
Returns a list of all bindings associated with keys greater than or equal to minKey, and less than or equal to maxKey. |
static DKSObject |
message2obj(DKSMessage m)
|
void |
printGraphRecv(java.lang.String id,
java.lang.String cnt)
|
void |
printGraphSend(java.lang.String id,
java.lang.String cnt)
|
void |
removeFromBinding(long key,
DKSObject value)
Value is removed from the list of bindings associated with key. |
void |
replicateH(DKSRef sender,
ReplicateMsg msg)
|
void |
replicationFinishedH(DKSRef sender,
ReplicationFinishedMsg rfmsg)
|
void |
RestoreItemsH(DKSRef sender,
DHTRestoreItemsMsg msg)
|
void |
restoreReplicas(DHTRestoreReplicasMsg repMsg)
|
void |
retrieveItemsH(DKSRef sender,
RetrieveItemsMsg msg)
|
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 fromNode)
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. |
DKSObject |
routeCallback(long identifier,
DKSObject payload)
Is set in DKSInterface through setCallbackHandler(). |
void |
routeCallbackAsync(long identifier,
DKSObject payload)
Is set in DKSInterface through setCallbackHandler(). |
void |
send(DKSObject message,
DKSRef rec)
Broadcasts the given message. |
void |
send(DKSObject message,
long recipientNodeId)
Send the message to the specified recipient node. |
void |
send(DKSRef target,
DKSMessage message)
Sends a DKSMessage to a DKS node |
void |
sendRestoreIntervals(java.util.List intervals,
int cc,
int id)
Instructs the callback system that a request should be sent for finding the information found in the passed intervals. |
void |
setDKSCallbacks(DKSCallbackInterface dksImpl)
|
void |
setMultipleLookupCount(int k)
Sets the number of concurrent lookups made when lookupBinding is called. |
void |
setReplicationDegree(int k)
Sets the number of times items are replicated in the DHT precondition: k must divide getKeyRange() (or getKeyRange() must be a multiple of k) must be invoked before join() or create(). |
void |
unregisterNode()
Every object implementing this interface gets registered in a ConnectionManager, this method this method unregisters the object in the ConnectionManager. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public DKSImpl myDKSImpl
| Constructor Detail |
|---|
public DKSDHTImpl(ConnectionManager cm,
long nodeId,
java.net.URL nodeAddress)
throws DKSNodeAlreadyRegistered
DKSNodeAlreadyRegistered
public DKSDHTImpl(ConnectionManager cm,
DKSOverlayAddress over)
throws DKSNodeAlreadyRegistered
DKSNodeAlreadyRegistered
public DKSDHTImpl(ConnectionManager cm,
DKSOverlayAddress over,
java.lang.Class ldht)
throws DKSNodeAlreadyRegistered
DKSNodeAlreadyRegistered
public DKSDHTImpl(ConnectionManager cm,
DKSOverlayAddress over,
DKSDHTCallback cb)
throws DKSNodeAlreadyRegistered
DKSNodeAlreadyRegistered| Method Detail |
|---|
public static DKSDHTImpl createDKSDiskDHT(ConnectionManager cm,
DKSOverlayAddress over)
throws DKSNodeAlreadyRegistered
DKSNodeAlreadyRegisteredpublic void create()
DKSInterface
create in interface DKSInterface
public void join(long existingnodeId,
java.net.URL existingnodeAddress)
throws DKSTooManyRestartJoins,
DKSIdentifierAlreadyTaken
DKSTooManyRestartJoins
DKSIdentifierAlreadyTaken
public void join(DKSRef existingnodeAddress)
throws DKSTooManyRestartJoins,
DKSIdentifierAlreadyTaken,
DKSRefNoResponse
DKSInterface
join in interface DKSInterfaceDKSTooManyRestartJoins
DKSIdentifierAlreadyTaken
DKSRefNoResponsepublic void logLevel(int level)
DKSInterface
logLevel in interface DKSInterfacelevel - int, 0 means no logging, 1 means debug prints, 2 means XML dumpspublic void leave()
leave in interface DKSInterface
public void addToBinding(long key,
DKSObject value)
addToBinding in interface DKSDHTInterface
public AsyncOperation[] addToBindingAsync(long key,
DKSObject value)
public DKSObject route(long identifier,
DKSObject payload)
DKSInterface
route in interface DKSInterfaceidentifier - whose responsible node being routed topayload - to be sent to the responsible node
DKSAppInterface
public void routeAsync(long identifier,
DKSObject payload)
DKSInterface
routeAsync in interface DKSInterfaceidentifier - whose responsible node being routed topayload - to be sent to the responsible nodeDKSAppInterface
public void routeAsyncFrom(long identifier,
DKSObject payload,
DKSRef fromNode)
DKSInterface
routeAsyncFrom in interface DKSInterfaceidentifier - longpayload - DKSObjectfromNode - DKSRef
public void removeFromBinding(long key,
DKSObject value)
removeFromBinding in interface DKSDHTInterface
public void changeBinding(long key,
DKSObject oldValue,
DKSObject newValue)
changeBinding in interface DKSDHTInterfacepublic DKSObject[] lookupBinding(long key)
lookupBinding in interface DKSDHTInterfacekey - long specifying the key to be looked up
DKSObject[] with values associated to
key
public DKSObject[] lookupBinding(long minKey,
long maxKey)
lookupBinding in interface DKSDHTInterface
public void send(DKSObject message,
long recipientNodeId)
public void send(DKSObject message,
DKSRef rec)
public void broadcast(DKSObject message)
broadcast in interface DKSDHTInterfacebroadcast in interface DKSInterface
public void broadcastRestricted(DKSObject message,
long startId,
long endId)
broadcastRestricted in interface DKSInterfacemessage - DKSObject message to be sentstartId - long beginning of the intervalendId - long end of the intervalpublic DKSMarshal getDKSMarshal()
public void setDKSCallbacks(DKSCallbackInterface dksImpl)
public static DKSObject message2obj(DKSMessage m)
public void routeCallbackAsync(long identifier,
DKSObject payload)
DKSAppInterface
routeCallbackAsync in interface DKSAppInterfaceidentifier - long, the identifier searched for in route, maybe not interesting for the app in many cases.payload - DKSObject, the actual payload sent by the source
public DKSObject routeCallback(long identifier,
DKSObject payload)
DKSAppInterface
routeCallback in interface DKSAppInterfaceidentifier - long, the identifier searched for in route, maybe not interesting for the app in many cases.payload - DKSObject, the actual payload sent by the source
public void failCallback(DKSRef failed,
DKSRef failedPred)
DKSAppInterface
failCallback in interface DKSAppInterfacefailed - DKSRef to the failed node (useful for DHT impl)failedPred - DKSRef to the failed nodes predecessor (useful for DHT impl)
public void retrieveItemsH(DKSRef sender,
RetrieveItemsMsg msg)
public void replicateH(DKSRef sender,
ReplicateMsg msg)
public void replicationFinishedH(DKSRef sender,
ReplicationFinishedMsg rfmsg)
public void RestoreItemsH(DKSRef sender,
DHTRestoreItemsMsg msg)
public void restoreReplicas(DHTRestoreReplicasMsg repMsg)
public void broadcastCallback(DKSObject payload)
DKSAppInterface
broadcastCallback in interface DKSAppInterfacepayload - DKSObject, the actual payload sent by the source
public void joinCallback(DKSRef pred,
DKSRef succ)
DKSAppInterface
joinCallback in interface DKSAppInterfacepred - DKSRef predecessor reference, containing the identifier of the predecessor (useful for DHT impl)succ - DKSRef successor, containing the identifier of the successor (useful for DHT impl)
public void leaveCallback(DKSRef pred,
DKSRef succ)
DKSAppInterface
leaveCallback in interface DKSAppInterfacepred - DKSRef predecessor reference, containing the identifier of the predecessor (useful for DHT impl)succ - DKSRef successor, containing the identifier of the successor (useful for DHT impl)public DHTStatistics getStatistics()
public java.lang.String getDKSURL()
DKSInterface
getDKSURL in interface DKSInterfaceDKSRefpublic long getMyId()
public long getPredecessorId()
public long getKeyRange()
public DKSRef findResponsible(long id)
DKSInterface
findResponsible in interface DKSInterfaceid - whose responsible node is being queried for
public void unregisterNode()
DKSInterface
unregisterNode in interface DKSInterfacepublic DKSDHTImpl getDHT()
DKSDHTVisualizationInterface
getDHT in interface DKSDHTVisualizationInterfacepublic DHTStorage[] getStorage()
public void sendRestoreIntervals(java.util.List intervals,
int cc,
int id)
FailedIntervalCallbackInterface
sendRestoreIntervals in interface FailedIntervalCallbackInterfaceintervals - The searched for intervals.cc - the congurence class that should be used.id - identity of the request, used to identify later downcallsDKSCallBackInterface, DKSAppInterface
public void printGraphSend(java.lang.String id,
java.lang.String cnt)
public void printGraphRecv(java.lang.String id,
java.lang.String cnt)
public void send(DKSRef target,
DKSMessage message)
DKSInterface
send in interface DKSInterfacetarget - a DKSRef to a node in the systemmessage - a DKSMessagepublic int getReplicationDegree()
public int getMultipleLookupCount()
public void setReplicationDegree(int k)
k - int replication degreepublic void setMultipleLookupCount(int k)
k - int
public boolean addMsgHandler(DKSMessage msg,
java.lang.Object handlerObject,
java.lang.String methodName)
DKSInterface
addMsgHandler in interface DKSInterfacemsg - 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.
DKSInterface.addMsgHandler()public DKSRef getDKSRef()
DKSInterface
getDKSRef in interface DKSInterfaceDKSRef
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||