public final class Initiator extends Object
This class represents an initiator, which request messages to a target defined by the iSCSI Protocol (RFC3720).
| Constructor and Description |
|---|
Initiator(Configuration initConfiguration)
Constructor to create an empty
Initiator object with the given configuration. |
| Modifier and Type | Method and Description |
|---|---|
void |
closeSession(String targetName)
Closes all opened connections within this session to the given target.
|
void |
createSession(InetSocketAddress targetAddress,
String targetName)
Creates a new session to a target with the given Internet address and port.
|
void |
createSession(String targetName)
Creates a new session with the given target name, which is read from the configuration file.
|
long |
getBlockSize(String targetName)
Returns the used block size (in bytes) of the iSCSI Target.
|
long |
getCapacity(String targetName)
Returns the capacity (in blocks) of the iSCSI Target.
|
Future<Void> |
multiThreadedRead(String targetName,
ByteBuffer dst,
int logicalBlockAddress,
long transferLength)
Invokes a read operation for the session
targetName and store the read bytes in the buffer
dst. |
Future<Void> |
multiThreadedWrite(String targetName,
ByteBuffer src,
int logicalBlockAddress,
long transferLength)
Invokes a write operation for the session
targetName and transmits the bytes in the buffer
dst. |
Boolean |
noSessions()
is the Sessions Map empty?.
|
void |
read(String targetName,
ByteBuffer dst,
int logicalBlockAddress,
long transferLength)
Invokes a read operation for the session
targetName and store the read bytes in the buffer
dst. |
void |
removeSession(Session sessionReq)
Removes the
Session instances form the sessions queue. |
void |
write(String targetName,
ByteBuffer src,
int logicalBlockAddress,
long transferLength)
Invokes a write operation for the session
targetName and transmits the bytes in the buffer
dst. |
public Initiator(Configuration initConfiguration)
Initiator object with the given configuration.initConfiguration - The user-defined configuration file.public final void createSession(String targetName) throws org.jscsi.exception.NoSuchSessionException
targetName - The name of the iSCSI Target to connect.org.jscsi.exception.NoSuchSessionException - if no session was foundpublic final void createSession(InetSocketAddress targetAddress, String targetName)
targetName.targetAddress - The Internet address and Port of the target.targetName - Name of the target, to which a connection should be created.Exception - if any error occurs.public final void closeSession(String targetName) throws org.jscsi.exception.NoSuchSessionException, org.jscsi.exception.TaskExecutionException
targetName - The name of the target, which connection should be closed.org.jscsi.exception.NoSuchSessionException - if no session is accessibleorg.jscsi.exception.TaskExecutionException - if logout fails.public final Future<Void> multiThreadedRead(String targetName, ByteBuffer dst, int logicalBlockAddress, long transferLength) throws org.jscsi.exception.NoSuchSessionException, org.jscsi.exception.TaskExecutionException
targetName and store the read bytes in the buffer
dst. Start reading at the logical block address and request transferLength blocks.targetName - The name of the session to invoke this read operation.dst - The buffer to store the read data.logicalBlockAddress - The logical block address of the beginning.transferLength - Number of bytes to read.Exception - if any error occurs.org.jscsi.exception.TaskExecutionException - if execution failsorg.jscsi.exception.NoSuchSessionException - if session is not foundpublic final void read(String targetName, ByteBuffer dst, int logicalBlockAddress, long transferLength) throws org.jscsi.exception.NoSuchSessionException, org.jscsi.exception.TaskExecutionException
targetName and store the read bytes in the buffer
dst. Start reading at the logical block address and request transferLength blocks.targetName - The name of the session to invoke this read operation.dst - The buffer to store the read data.logicalBlockAddress - The logical block address of the beginning.transferLength - Number of bytes to read.org.jscsi.exception.TaskExecutionException - if execution failsorg.jscsi.exception.NoSuchSessionException - if session is not foundpublic final Future<Void> multiThreadedWrite(String targetName, ByteBuffer src, int logicalBlockAddress, long transferLength) throws org.jscsi.exception.NoSuchSessionException, org.jscsi.exception.TaskExecutionException
targetName and transmits the bytes in the buffer
dst. Start writing at the logical block address and transmit transferLength blocks.targetName - The name of the session to invoke this write operation.src - The buffer to transmit.logicalBlockAddress - The logical block address of the beginning.transferLength - Number of bytes to write.Exception - if any error occurs.org.jscsi.exception.TaskExecutionException - if execution failsorg.jscsi.exception.NoSuchSessionException - if session is not foundpublic final void write(String targetName, ByteBuffer src, int logicalBlockAddress, long transferLength) throws org.jscsi.exception.NoSuchSessionException, org.jscsi.exception.TaskExecutionException
targetName and transmits the bytes in the buffer
dst. Start writing at the logical block address and transmit transferLength blocks.targetName - The name of the session to invoke this write operation.src - The buffer to transmit.logicalBlockAddress - The logical block address of the beginning.transferLength - Number of bytes to write.org.jscsi.exception.TaskExecutionException - if execution failsorg.jscsi.exception.NoSuchSessionException - if session is not foundpublic final long getBlockSize(String targetName) throws org.jscsi.exception.NoSuchSessionException
targetName - The name of the session to invoke this capacity operation.org.jscsi.exception.NoSuchSessionException - if the session connected to the target is yet not open.public final long getCapacity(String targetName) throws org.jscsi.exception.NoSuchSessionException
targetName - The name of the session to invoke this capacity operation.org.jscsi.exception.NoSuchSessionException - if the session connected to the target is yet not open.public final void removeSession(Session sessionReq) throws org.jscsi.exception.NoSuchSessionException
Session instances form the sessions queue.sessionReq - The Session to removeorg.jscsi.exception.NoSuchSessionException - if the Session does not exist in the Mappublic final Boolean noSessions()
Copyright © 2013 University of Konstanz, Distributed Systems Group. All Rights Reserved.