org.tranche.remote
Class RemoteTrancheServer

java.lang.Object
  extended by org.tranche.commons.Debuggable
      extended by org.tranche.TrancheServer
          extended by org.tranche.remote.RemoteTrancheServer

public class RemoteTrancheServer
extends TrancheServer

Handles client socket connection to the server.

Author:
Jayson, Bryan E. Smith - bryanesmith@gmail.com, James "Augie" Hill - augman85@gmail.com

Field Summary
static int BATCH_GET_LIMIT
          Limit for batch-get requests.
static int BATCH_HAS_LIMIT
          Absolute limit for all batch sizes.
static int BATCH_NONCE_LIMIT
          Limit for batch-nonce requests.
static int BATCH_SET_LIMIT
          Limit for batch-set requests.
protected  java.net.Socket dataSocket
           
static int DEFAULT_MAX_TRIES
           
static long DEFAULT_RESPONSE_TIMEOUT
           
protected  RemoteTrancheServerDownloadThread downloadThread
           
static byte OK_BYTE
          Abstract OK byte to keep sync in order
protected  java.util.LinkedList<OutGoingBytes> outgoingQueue
           
protected  java.util.Map<java.lang.Long,RemoteCallback> outgoingSent
          Buffer of outgoing tasks
static long responseTimeout
          The number of milliseconds before a response is decidedly not going to be returned.
protected  RemoteTrancheServerUploadThread uploadThread
           
 
Fields inherited from class org.tranche.TrancheServer
BAD_NONCE, BAD_SIG
 
Constructor Summary
RemoteTrancheServer(java.lang.String host, int port, boolean secure)
           
 
Method Summary
 void addListener(RemoteTrancheServerListener l)
          Adds the given server listener from the list of server listeners.
 void clearListeners()
          Removes all server listeners.
 void close()
          Tears down the TCP connection to the remote server and releases the associated resources.
 int countOutstandingRequests()
           
 PropagationReturnWrapper deleteData(BigHash hash, Signature[] sigs, byte[][] nonces, java.lang.String[] hosts)
          Delete data chunk from selected servers.
 PropagationReturnWrapper deleteMetaData(BigHash hash, java.lang.String uploaderName, java.lang.Long uploadTimestamp, java.lang.String relativePathInDataSet, Signature[] sigs, byte[][] nonces, java.lang.String[] hosts)
           
 boolean equals(java.lang.Object obj)
          Returns whether the URL for this server is the same as the URL for the given server.
protected  void fireCreatedBytesToUpload(long callbackId, long bytesToUpload)
          Notify the listeners that bytes have been created to go to the server.
protected  void fireCreatedCallback(RemoteCallback rc)
          Notify server listeners that a new callback has been created.
protected  void fireFailedCallback(RemoteCallback rc)
          Notify server listeners that a server request failed.
protected  void fireFailedDownloadingBytes(long callbackId)
          Notify the listeners that bytes have failed to be downloaded from the server.
protected  void fireFailedUploadingBytes(long callbackId)
          Notify the listeners that bytes could not be uploaded to the server.
protected  void fireFinishedDownloadingBytes(long callbackId, long bytesToDownload, long bytesDownloaded)
          Notify the listeners that bytes have been downloaded from the server.
protected  void fireFinishedUploadingBytes(long callbackId, long bytesToUpload, long bytesUploaded)
          Notify the listeners that bytes have been uploaded to the server.
protected  void fireFulfilledCallback(RemoteCallback rc)
          Notify server listeners that a server request has been fulfilled.
protected  void fireNewConnection()
          Notify the listeners that a new connection has been made to the server.
protected  void fireStartedDownloadingBytes(long callbackId, long bytesToDownload)
          Notify the listeners that bytes have been downloaded from the server.
protected  void fireStartedUploadingBytes(long callbackId, long bytesToUpload)
          Notify the listeners that bytes are starting to be uploaded to the server.
protected  void fireUpdateDownloadingBytes(long callbackId, long bytesToDownload, long bytesDownloaded)
          Notify the listeners that bytes have been downloaded from the server.
protected  void flushOutputStreams()
          Send the output.
 Activity[] getActivityLogEntries(long startTimestamp, long finishTimestamp, int limit, byte mask)
          Get all activity log entries from within a time period.
 int getActivityLogEntriesCount(long startTimestamp, long stopTimestamp, byte mask)
          Returns a count of all activity log entries from within a time period.
 Configuration getConfiguration()
          Gets the configuration from the remote tranche server.
 Configuration getConfiguration(Signature sig, byte[] nonce)
          Gets the configuration from the remote tranche server.
 PropagationReturnWrapper getData(BigHash[] hashes, boolean propagateRequest)
          Gets a list of data chunks corresponding to the given list of hashes from the remote tranche server.
 BigHash[] getDataHashes(java.math.BigInteger offset, java.math.BigInteger length)
          Returns a list of data hashes from the remote tranche server.
protected  java.io.DataInputStream getDataInputStream()
           
protected  java.io.DataOutputStream getDataOutputStream()
           
 java.lang.String getHost()
          Gets the host name of the remote tranche server.
 long getLastTimeNotify(int index)
          Used to track timestamps of last time client sent request to server.
 long getLastTimeWakeUp(int index)
          Used to track timestamps of last time client download thread resumed after a wait.
 java.util.Collection<RemoteTrancheServerListener> getListeners()
          Returns the list of server listeners.
static int getMaxTries()
          Returns the maximum number of attempts before failing.
 PropagationReturnWrapper getMetaData(BigHash[] hashes, boolean propagateRequest)
          Gets a list of meta data chunks corresponding to the given list of hashes from the remote tranche server.
 BigHash[] getMetaDataHashes(java.math.BigInteger offset, java.math.BigInteger length)
          Returns a list of meta data hashes from the remote tranche server.
 long getMillisSinceLastServerResponse()
          Time in milliseconds since last server response.
 StatusTable getNetworkStatus()
           
 StatusTable getNetworkStatusPortion(java.lang.String startHost, java.lang.String endHost)
           
 PropagationReturnWrapper getNonces(java.lang.String[] hosts, int count)
          Get batch of nonces from selected server hosts.
 int getPort()
          Gest the port number of the remote tranche server.
 BigHash[] getProjectHashes(java.math.BigInteger offset, java.math.BigInteger length)
          Remote protocol for sending project hashes.
static long getResponseTimeout()
           
 long getTimeLastServerResponse()
          Returns the UNIX timetsamp of the last server response.
 long getTimeLastUsed()
          Gets the time this server was last communicated with.
 boolean[] hasData(BigHash[] hashes)
          Asks whether the remote tranche server has the given list of data chunks.
 BooleanArrayCallback hasDataInternal(BigHash[] hashes)
           
 int hashCode()
          Returns the hash code of the URL for this server.
 boolean[] hasMetaData(BigHash[] hashes)
          Asks whether the remote tranche server has the given list of meta data chunks.
 BooleanArrayCallback hasMetaDataInternal(BigHash[] hashes)
           
 boolean isClosed()
           
 boolean isSecure()
          Does this server use SSL?
protected  void notifyPreviousCallbacks(long id, java.lang.String reasonMsg)
          Ends all pending callbacks with ids before a certain id.
 void ping()
          Pings the remote tranche server.
 boolean purge(long id, RemoteCallback callback, java.lang.String reason)
          Ask RTS to purge callback.
protected  void reconnect()
          Intelligently reconnect or connect to the remote Tranche server.
 void registerServer(java.lang.String url)
          Register a tranche server with the remote tranche server.
 void removeListener(RemoteTrancheServerListener l)
          Removes the given server listener from the list of server listeners.
 void removeListeners(java.util.List<RemoteTrancheServerListener> listeners)
          Removes the given server listeners from the list of server listeners.
 void requestShutdown(Signature sig, byte[] nonce)
          Sends a request for a shutdown to the remote tranche server.
 void setConfiguration(byte[] data, Signature sig, byte[] nonce)
          Sets the configuration to the remote tranche server.
 PropagationReturnWrapper setData(BigHash hash, byte[] data, Signature sig, java.lang.String[] hosts)
          Set data and replicate to specified hosts.
 void setLastTimeNotify(long timestamp)
          Used to track timestamps of last time client sent request to server.
 void setLastTimeWakeUp(long timestamp)
          Used to track timestamps of last time client download thread resumed after a wait.
 void setListeners(java.util.List<RemoteTrancheServerListener> listeners)
          Replace the list of server listeners with the given list.
static void setMaxRetries(int maxRetries)
          Sets the maximum number of connection attempts before failing.
 PropagationReturnWrapper setMetaData(boolean merge, BigHash hash, byte[] data, Signature sig, java.lang.String[] hosts)
          Set meta data and replicate to specified hosts.
static void setMultiSocketTest(boolean isMultiSocketTest)
          Used for stress testing only.
static void setResponseTimeout(long milliseconds)
           
 void setTimeLastServerResponse(long timeLastServerResponse)
          Set the timestamp of the server's last message received.
 void setTimeLastUsed(long timeLastUsed)
          Sets the time this server was last communicated with.
 void submitLatencyChunk(int latency)
          Submit the latency of the chunk to server.
 void submitLatencyNonce(int latency)
          Submit the latency of the nonce to server.
 
Methods inherited from class org.tranche.commons.Debuggable
debugErr, debugErr, debugOut, isDebug, setDebug
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BATCH_HAS_LIMIT

public static final int BATCH_HAS_LIMIT

Absolute limit for all batch sizes. Likely to change.

See Also:
Constant Field Values

BATCH_GET_LIMIT

public static final int BATCH_GET_LIMIT

Limit for batch-get requests.

See Also:
Constant Field Values

BATCH_SET_LIMIT

public static final int BATCH_SET_LIMIT

Limit for batch-set requests.

See Also:
Constant Field Values

BATCH_NONCE_LIMIT

public static final int BATCH_NONCE_LIMIT

Limit for batch-nonce requests.

See Also:
Constant Field Values

OK_BYTE

public static final byte OK_BYTE

Abstract OK byte to keep sync in order

See Also:
Constant Field Values

DEFAULT_RESPONSE_TIMEOUT

public static final long DEFAULT_RESPONSE_TIMEOUT

DEFAULT_MAX_TRIES

public static final int DEFAULT_MAX_TRIES
See Also:
Constant Field Values

responseTimeout

public static long responseTimeout

The number of milliseconds before a response is decidedly not going to be returned.


dataSocket

protected java.net.Socket dataSocket

outgoingSent

protected final java.util.Map<java.lang.Long,RemoteCallback> outgoingSent

Buffer of outgoing tasks


outgoingQueue

protected final java.util.LinkedList<OutGoingBytes> outgoingQueue

downloadThread

protected final RemoteTrancheServerDownloadThread downloadThread

uploadThread

protected final RemoteTrancheServerUploadThread uploadThread
Constructor Detail

RemoteTrancheServer

public RemoteTrancheServer(java.lang.String host,
                           int port,
                           boolean secure)
                    throws java.lang.Exception
Parameters:
host -
port -
secure -
Throws:
java.lang.Exception
Method Detail

reconnect

protected void reconnect()
                  throws java.io.IOException

Intelligently reconnect or connect to the remote Tranche server.

Throws:
java.io.IOException

getDataOutputStream

protected java.io.DataOutputStream getDataOutputStream()
Returns:

getDataInputStream

protected java.io.DataInputStream getDataInputStream()
Returns:

countOutstandingRequests

public int countOutstandingRequests()
Returns:

purge

public boolean purge(long id,
                     RemoteCallback callback,
                     java.lang.String reason)
              throws java.lang.Exception

Ask RTS to purge callback. Must have matchign copy of callback or will not purge.

Parameters:
id -
callback -
reason -
Returns:
Throws:
java.lang.Exception

notifyPreviousCallbacks

protected void notifyPreviousCallbacks(long id,
                                       java.lang.String reasonMsg)

Ends all pending callbacks with ids before a certain id.

Parameters:
id -
reasonMsg -

flushOutputStreams

protected void flushOutputStreams()

Send the output.


getPort

public int getPort()

Gest the port number of the remote tranche server.

Returns:

getHost

public java.lang.String getHost()

Gets the host name of the remote tranche server.

Specified by:
getHost in class TrancheServer
Returns:

hasMetaData

public boolean[] hasMetaData(BigHash[] hashes)
                      throws java.lang.Exception

Asks whether the remote tranche server has the given list of meta data chunks.

Specified by:
hasMetaData in class TrancheServer
Parameters:
hashes -
Returns:
Throws:
java.lang.Exception

hasMetaDataInternal

public BooleanArrayCallback hasMetaDataInternal(BigHash[] hashes)
                                         throws java.lang.Exception
Throws:
java.lang.Exception

hasData

public boolean[] hasData(BigHash[] hashes)
                  throws java.lang.Exception

Asks whether the remote tranche server has the given list of data chunks.

Specified by:
hasData in class TrancheServer
Parameters:
hashes -
Returns:
Throws:
java.lang.Exception

hasDataInternal

public BooleanArrayCallback hasDataInternal(BigHash[] hashes)
                                     throws java.lang.Exception
Parameters:
hashes -
Returns:
Throws:
java.lang.Exception

getNetworkStatus

public StatusTable getNetworkStatus()
                             throws java.lang.Exception
Returns:
Throws:
java.lang.Exception

getNetworkStatusPortion

public StatusTable getNetworkStatusPortion(java.lang.String startHost,
                                           java.lang.String endHost)
                                    throws java.lang.Exception
Specified by:
getNetworkStatusPortion in class TrancheServer
Parameters:
startHost -
endHost -
Returns:
Throws:
java.lang.Exception

ping

public void ping()
          throws java.lang.Exception

Pings the remote tranche server.

Specified by:
ping in class TrancheServer
Throws:
java.lang.Exception

requestShutdown

public void requestShutdown(Signature sig,
                            byte[] nonce)
                     throws java.lang.Exception

Sends a request for a shutdown to the remote tranche server.

Specified by:
requestShutdown in class TrancheServer
Parameters:
sig -
nonce -
Throws:
java.lang.Exception

getDataHashes

public BigHash[] getDataHashes(java.math.BigInteger offset,
                               java.math.BigInteger length)
                        throws java.lang.Exception

Returns a list of data hashes from the remote tranche server.

Specified by:
getDataHashes in class TrancheServer
Parameters:
offset -
length -
Returns:
Throws:
java.lang.Exception

getMetaDataHashes

public BigHash[] getMetaDataHashes(java.math.BigInteger offset,
                                   java.math.BigInteger length)
                            throws java.lang.Exception

Returns a list of meta data hashes from the remote tranche server.

Specified by:
getMetaDataHashes in class TrancheServer
Parameters:
offset -
length -
Returns:
Throws:
java.lang.Exception

registerServer

public void registerServer(java.lang.String url)
                    throws java.lang.Exception

Register a tranche server with the remote tranche server.

Specified by:
registerServer in class TrancheServer
Parameters:
url -
Throws:
java.lang.Exception

getConfiguration

public Configuration getConfiguration()
                               throws java.lang.Exception

Gets the configuration from the remote tranche server.

Specified by:
getConfiguration in class TrancheServer
Returns:
Throws:
java.lang.Exception

getConfiguration

public Configuration getConfiguration(Signature sig,
                                      byte[] nonce)
                               throws java.lang.Exception

Gets the configuration from the remote tranche server.

Specified by:
getConfiguration in class TrancheServer
Parameters:
sig -
nonce -
Returns:
Throws:
java.lang.Exception

setConfiguration

public void setConfiguration(byte[] data,
                             Signature sig,
                             byte[] nonce)
                      throws java.lang.Exception

Sets the configuration to the remote tranche server.

Specified by:
setConfiguration in class TrancheServer
Parameters:
data -
sig -
nonce -
Throws:
java.lang.Exception

getProjectHashes

public BigHash[] getProjectHashes(java.math.BigInteger offset,
                                  java.math.BigInteger length)
                           throws java.lang.Exception

Remote protocol for sending project hashes.

Specified by:
getProjectHashes in class TrancheServer
Parameters:
offset -
length -
Returns:
Throws:
java.lang.Exception

getData

public PropagationReturnWrapper getData(BigHash[] hashes,
                                        boolean propagateRequest)
                                 throws java.lang.Exception

Gets a list of data chunks corresponding to the given list of hashes from the remote tranche server.

Specified by:
getData in class TrancheServer
Parameters:
hashes -
propagateRequest -
Returns:
Throws:
java.lang.Exception

getMetaData

public PropagationReturnWrapper getMetaData(BigHash[] hashes,
                                            boolean propagateRequest)
                                     throws java.lang.Exception

Gets a list of meta data chunks corresponding to the given list of hashes from the remote tranche server.

Specified by:
getMetaData in class TrancheServer
Parameters:
hashes -
propagateRequest -
Returns:
Throws:
java.lang.Exception

getActivityLogEntries

public Activity[] getActivityLogEntries(long startTimestamp,
                                        long finishTimestamp,
                                        int limit,
                                        byte mask)
                                 throws java.lang.Exception

Get all activity log entries from within a time period.

Specified by:
getActivityLogEntries in class TrancheServer
Parameters:
startTimestamp - Timestamp from which to include activities (inclusive)
finishTimestamp - Timestamp to which to include activities (inclusive)
limit - Limit number of activity entries to return
mask - Used to match activity bytes. If all the bits in the mask are included in the activity byte, then the activity will be included. For example, if the mask is Activity.ACTION_TYPE_SET, then all logs that have this bit set (set data and set meta data) will be included. However, if Activity.SET_DATA is the mask, then only set data actions will match (since there are two bits set in the mask, making it more restrictive). 0 is least restrictive (restricts nothing) and 0xFF is most restrictive (restricts everything but itself).
Returns:
Throws:
java.lang.Exception

getActivityLogEntriesCount

public int getActivityLogEntriesCount(long startTimestamp,
                                      long stopTimestamp,
                                      byte mask)
                               throws java.lang.Exception

Returns a count of all activity log entries from within a time period.

Specified by:
getActivityLogEntriesCount in class TrancheServer
Parameters:
startTimestamp - Timestamp from which to include activities (inclusive)
stopTimestamp - Timestamp to which to include activities (inclusive)
mask - Used to match activity bytes. If all the bits in the mask are included in the activity byte, then the activity will be included. For example, if the mask is Activity.ACTION_TYPE_SET, then all logs that have this bit set (set data and set meta data) will be included. However, if Activity.SET_DATA is the mask, then only set data actions will match (since there are two bits set in the mask, making it more restrictive). 0 is least restrictive (restricts nothing) and 0xFF is most restrictive (restricts everything but itself).
Returns:
Throws:
java.lang.Exception

setMultiSocketTest

public static void setMultiSocketTest(boolean isMultiSocketTest)

Used for stress testing only.

Parameters:
isMultiSocketTest -

close

public void close()

Tears down the TCP connection to the remote server and releases the associated resources. If another method is invoked by this RemoteDistributedFileSystem, the TCP connection will automatically be re-established. i.e. this method is a way to terminate lingering TCP connections that likly won't be needed.

Specified by:
close in class TrancheServer

isSecure

public boolean isSecure()

Does this server use SSL?

Returns:

isClosed

public boolean isClosed()
Returns:

equals

public boolean equals(java.lang.Object obj)

Returns whether the URL for this server is the same as the URL for the given server.

Overrides:
equals in class java.lang.Object
Parameters:
obj -
Returns:

hashCode

public int hashCode()

Returns the hash code of the URL for this server.

Overrides:
hashCode in class java.lang.Object
Returns:

getMillisSinceLastServerResponse

public long getMillisSinceLastServerResponse()

Time in milliseconds since last server response.

Returns:

submitLatencyChunk

public void submitLatencyChunk(int latency)

Submit the latency of the chunk to server. Tries once then quits.

Parameters:
latency -

submitLatencyNonce

public void submitLatencyNonce(int latency)

Submit the latency of the nonce to server. Tries once then quits.

Parameters:
latency -

getTimeLastUsed

public long getTimeLastUsed()

Gets the time this server was last communicated with.

Returns:

setTimeLastUsed

public void setTimeLastUsed(long timeLastUsed)

Sets the time this server was last communicated with.

Parameters:
timeLastUsed -

setLastTimeWakeUp

public void setLastTimeWakeUp(long timestamp)

Used to track timestamps of last time client download thread resumed after a wait. Used for detecting timeouts and thread synchronization issues.

Parameters:
timestamp -

getLastTimeWakeUp

public long getLastTimeWakeUp(int index)

Used to track timestamps of last time client download thread resumed after a wait. Used for detecting timeouts and thread synchronization issues.

Parameters:
index -
Returns:

setLastTimeNotify

public void setLastTimeNotify(long timestamp)

Used to track timestamps of last time client sent request to server. Used for detecting timeouts.

Parameters:
timestamp -

getLastTimeNotify

public long getLastTimeNotify(int index)

Used to track timestamps of last time client sent request to server. Used for detecting timeouts.

Parameters:
index -
Returns:

getTimeLastServerResponse

public long getTimeLastServerResponse()

Returns the UNIX timetsamp of the last server response.

Returns:
The timestamp of the server's last message received.

setTimeLastServerResponse

public void setTimeLastServerResponse(long timeLastServerResponse)

Set the timestamp of the server's last message received.

Parameters:
timeLastServerResponse -

setListeners

public void setListeners(java.util.List<RemoteTrancheServerListener> listeners)

Replace the list of server listeners with the given list.

Parameters:
listeners -

addListener

public void addListener(RemoteTrancheServerListener l)

Adds the given server listener from the list of server listeners.

Parameters:
l -

removeListener

public void removeListener(RemoteTrancheServerListener l)

Removes the given server listener from the list of server listeners.

Parameters:
l -

removeListeners

public void removeListeners(java.util.List<RemoteTrancheServerListener> listeners)

Removes the given server listeners from the list of server listeners.

Parameters:
listeners -

clearListeners

public void clearListeners()

Removes all server listeners.


getListeners

public java.util.Collection<RemoteTrancheServerListener> getListeners()

Returns the list of server listeners.

Returns:

fireNewConnection

protected void fireNewConnection()

Notify the listeners that a new connection has been made to the server.


fireStartedDownloadingBytes

protected void fireStartedDownloadingBytes(long callbackId,
                                           long bytesToDownload)

Notify the listeners that bytes have been downloaded from the server.

Parameters:
callbackId -
bytesToDownload -

fireUpdateDownloadingBytes

protected void fireUpdateDownloadingBytes(long callbackId,
                                          long bytesToDownload,
                                          long bytesDownloaded)

Notify the listeners that bytes have been downloaded from the server.

Parameters:
callbackId -
bytesToDownload -
bytesDownloaded -

fireFinishedDownloadingBytes

protected void fireFinishedDownloadingBytes(long callbackId,
                                            long bytesToDownload,
                                            long bytesDownloaded)

Notify the listeners that bytes have been downloaded from the server.

Parameters:
callbackId -
bytesToDownload -
bytesDownloaded -

fireFailedDownloadingBytes

protected void fireFailedDownloadingBytes(long callbackId)

Notify the listeners that bytes have failed to be downloaded from the server.

Parameters:
callbackId -

fireCreatedBytesToUpload

protected void fireCreatedBytesToUpload(long callbackId,
                                        long bytesToUpload)

Notify the listeners that bytes have been created to go to the server.

Parameters:
callbackId -
bytesToUpload -

fireStartedUploadingBytes

protected void fireStartedUploadingBytes(long callbackId,
                                         long bytesToUpload)

Notify the listeners that bytes are starting to be uploaded to the server.

Parameters:
callbackId -
bytesToUpload -

fireFinishedUploadingBytes

protected void fireFinishedUploadingBytes(long callbackId,
                                          long bytesToUpload,
                                          long bytesUploaded)

Notify the listeners that bytes have been uploaded to the server.

Parameters:
callbackId -
bytesToUpload -
bytesUploaded -

fireFailedUploadingBytes

protected void fireFailedUploadingBytes(long callbackId)

Notify the listeners that bytes could not be uploaded to the server.

Parameters:
callbackId -

fireCreatedCallback

protected void fireCreatedCallback(RemoteCallback rc)

Notify server listeners that a new callback has been created.

Parameters:
rc -

fireFulfilledCallback

protected void fireFulfilledCallback(RemoteCallback rc)

Notify server listeners that a server request has been fulfilled.

Parameters:
rc -

fireFailedCallback

protected void fireFailedCallback(RemoteCallback rc)

Notify server listeners that a server request failed.

Parameters:
rc -

getMaxTries

public static int getMaxTries()

Returns the maximum number of attempts before failing.

Returns:

setMaxRetries

public static void setMaxRetries(int maxRetries)

Sets the maximum number of connection attempts before failing.

Parameters:
maxRetries -

setResponseTimeout

public static void setResponseTimeout(long milliseconds)
Parameters:
milliseconds -

getResponseTimeout

public static long getResponseTimeout()
Returns:

setData

public PropagationReturnWrapper setData(BigHash hash,
                                        byte[] data,
                                        Signature sig,
                                        java.lang.String[] hosts)
                                 throws java.lang.Exception

Set data and replicate to specified hosts.

Specified by:
setData in class TrancheServer
Parameters:
hash -
data -
sig -
hosts -
Returns:
Throws:
java.lang.Exception

setMetaData

public PropagationReturnWrapper setMetaData(boolean merge,
                                            BigHash hash,
                                            byte[] data,
                                            Signature sig,
                                            java.lang.String[] hosts)
                                     throws java.lang.Exception

Set meta data and replicate to specified hosts.

Specified by:
setMetaData in class TrancheServer
Parameters:
merge -
hash -
data -
sig -
hosts -
Returns:
Throws:
java.lang.Exception

getNonces

public PropagationReturnWrapper getNonces(java.lang.String[] hosts,
                                          int count)
                                   throws java.lang.Exception

Get batch of nonces from selected server hosts.

Specified by:
getNonces in class TrancheServer
Parameters:
hosts -
count -
Returns:
bytes[host index][nonce index][nonce bytes]. So, val[1][3][] returns the fourth nonce for second server. If want to reference all nonce for server 2: val[1]
Throws:
java.lang.Exception

deleteData

public PropagationReturnWrapper deleteData(BigHash hash,
                                           Signature[] sigs,
                                           byte[][] nonces,
                                           java.lang.String[] hosts)
                                    throws java.lang.Exception

Delete data chunk from selected servers.

Specified by:
deleteData in class TrancheServer
Parameters:
hash -
sigs -
nonces -
hosts -
Throws:
java.lang.Exception

deleteMetaData

public PropagationReturnWrapper deleteMetaData(BigHash hash,
                                               java.lang.String uploaderName,
                                               java.lang.Long uploadTimestamp,
                                               java.lang.String relativePathInDataSet,
                                               Signature[] sigs,
                                               byte[][] nonces,
                                               java.lang.String[] hosts)
                                        throws java.lang.Exception
Specified by:
deleteMetaData in class TrancheServer
Parameters:
hash -
uploaderName -
uploadTimestamp -
relativePathInDataSet -
sigs -
nonces -
hosts -
Throws:
java.lang.Exception


This code is free for use both commercially and non-commercially as stated in the project's license