dCap : The dCache Access Protocol (Version 4)

Client - Mover

Overview


Command - Data Flow

Write Request Sequence

Client-ServerRequest / Data
-->WRITE REQUEST
<--WRITE REQUEST ACK
-->DATA CHAIN
<--WRITE REQUEST FIN

Read Request Sequence

Client-ServerRequest / Data
-->READ REQUEST
<--READ REQUEST ACK
<--DATA CHAIN
<--READ REQUEST FIN

Seek/Locate/Status Request Sequence

Client-ServerRequest / Data
-->SEEK/LOCATE/STATUS REQUEST
<--SEEK REQUEST ACK

Close Request Sequence

Client-ServerRequest / Data
-->CLOSE REQUEST
<--CLOSE REQUEST ACK

Interrupt Request Sequence

Data Chain sender - Data Chain receiverRequest / Data
<--LOCATE REQUEST

Overview

Command REQUEST_ACK DATA CHAIN REQUEST_FIN
READ (AND SEEK) X X X
WRITE (AND SEEK) X X X
SEEK X - -
LOCATE X - -
STATUS X - -
CLOSE X - -

Generic Building Blocks

Mover HELLO Block

ValueLength (Bytes)
Session ID4
Number of bytes following for the challenge4
ChallengeCommand dependent

Generic REQUEST Block

ValueLength (Bytes)
Number of Bytes following4
Command code4
ArgumentsCommand dependent

Generic ACK/FIN Block

Success
ValueLength (Bytes)
Number of Bytes following4
REQUEST_ACK=6 / REQUEST_FIN=74
Corresponding IOCMD code4
Return code (success==0)4
[arg1]length(arg1)
[...]length(...)
Return argumentsCommand dependent
Failure
ValueLength (Bytes)
Number of Bytes following4
REQUEST_ACK=6 / REQUEST_FIN=74
Corresponding IOCMD code4
Return code (failure!=0)4
UTF-8 UNICODE stringlength is defined by UTF-8

Generic DATA Chain

ValueLength (Bytes)
Number of Bytes following = 4 4
DATA = 8 4
Number of Bytes following = <n1> 4
<user data> <n1>
Number of Bytes following = <n2> 4
<user data> <n2>
... ...
Number of Bytes following = -1 4

dCache Requests in Detail

The Write (SeekAndWrite) Request

The client initiates the transaction by sending the Write Request Block, WRB. The WRB doesn't contain any information about the number of bytes, the client intends to write, in order to allow streaming from an unknown data source. In the case of SeekAndWrite the Request block additionally contains the seek offset and the seek 'whence' code.

Request : Client -> Server

WriteSeek And Write
Value Length (Bytes)
4 4
WRITE=1 4
Value Length (Bytes)
16 4
SEEK_AND_WRITE=12 4
offset 8
whence 4

Whence Meaning Code
SEEK_SET From Beginning of File 0
SEEK_CURRENT From Current File Position 1
SEEK_END From End Of File 2

The Server returns the Write Request Ack, WRA indicating whether or not the Write Request is granted.

Granted (Server -> Client)

The server agrees to take any amount of data coming from the client.

Value Length (Bytes)
Number of Bytes following = 12 4
REQUEST_ACK = 6 4
IOCMD code WRITE (1), SEEK_AND_WRITE (12) 4
success= 0 4

The server limits the maximum number of bytes sent by the client.

Value Length (Bytes)
Number of Bytes following = 24 4
REQUEST_ACK (6) 4
IOCMD code WRITE (1), SEEK_AND_WRITE (12) 4
success= 0 4
DONT_SEND_MORE 4
<max number of bytes> 8

The server asks the client to expect a new data connection from a different server. The client has to issue this command again after the new server has been successfully connected. The client must not send a DCAP CLOSE command on the current connection but should assume that the server is going to close this connection rather soon.

Value Length (Bytes)
Number of Bytes following = 16 4
REQUEST_ACK = 6 4
IOCMD code WRITE (1), SEEK_AND_WRITE (12) 4
success= 0 4
EXPECT_NEW_CONNECTION 4

Denied (Server -> Client)

Value Length (Bytes)
Number of Bytes following 4
REQUEST_ACK = 6 4
IOCMD code (WRITE=1,SEEK_AND_WRITE=12) 4
failure=<ErrorNumber!=0> 4
Detail : UTF-8 UNICODE length is defined by UTF-8
In case, the request is denied, the Write Request Sequence has ended. If the server replies with success, the client is requested to send the Data Chain.

Data Chain : Client -> Server

ValueLength (Bytes)
Number of Bytes following = 4 4
DATA = 8 4
Number of Bytes following = <n1> 4
<user data> <n1>
Number of Bytes following = <n2> 4
<user data> <n2>
... ...
Number of Bytes following = -1 4
In case, the server was able to store all the data sent by the client it (the server) sends the Write Request Fin packet.

Write OK (Server -> Client)

ValueLength (Bytes)
Number of Bytes following = 12 4
REQUEST_FIN = 7 4
IOCMD code (WRITE = 1) 4
success= 0 4
otherwise the server reports on an error.

Write Failed (Server -> Client)

ValueLength (Bytes)
Number of Bytes following 4
REQUEST_FIN = 74
IOCMD code (WRITE = 1)4
failure=<ErrorNumber!=0>4
Detail : UTF-8 UNICODElength is defined by UTF-8

The Read (SeekAndRead) Request

The client initiales the transaction by sending the Read Request Block, RRB. The RRB contains the number of bytes the client want to read from the connected dataset. In the case of SeekAndRead the Request block additionally contains the seek offset and the seek 'whence' code.

Read / SeekAndRead Request : Client -> Server

ValueLength (Bytes)
124
READ=24
readBlockLength8
ValueLength (Bytes)
244
SEEK_AND_READ=114
offset8
whence4
readBlockLength8

WhenceMeaningCode
SEEK_SETFrom Beginning of File0
SEEK_CURRENTFrom Current File Position1
SEEK_ENDFrom End Of File2

The server returns the Read Request Ack, indicating whether or not the Read Request is granted.

Granted (Server -> Client)

Value Length (Bytes)
Number of Bytes following = 12 4
REQUEST_ACK (6) 4
IOCMD code READ (2), SEEK_AND_READ (11) 4
success= 0 4

The server asks the client to expect a new data connection from a different server. The client has to issue this command again after the new server has been successfully connected. The client must not send a DCAP CLOSE command on the current connection but should assume that the server is going to close this connection rather soon.

Value Length (Bytes)
Number of Bytes following = 12 4
REQUEST_ACK (6) 4
IOCMD code READ (2), SEEK_AND_READ (11) 4
success= 0 4
EXPECT_NEW_CONNECTION 4

Denied (Server -> Client)

ValueLength (Bytes)
Number of Bytes following 4
REQUEST_ACK = 64
IOCMD code (READ=2,SEEK_AND_READ=11)4
failure=<ErrorNumber!=0>4
Detail : UTF-8 UNICODElength is defined by UTF-8
In case, the request is denied, the Read Request Sequence has ended. If the server replies with success, it will proceed by sending the Data Chain. The server will send exactly the number of bytes requested except :

Data Chain : Server -> Client

ValueLength (Bytes)
Number of Bytes following = 4 4
DATA = 8 4
Number of Bytes following = <n1> 4
<user data> <n1>
Number of Bytes following = <n2> 4
<user data> <n2>
... ...
Number of Bytes following = -1 4
If no error was detected while sending the data to the client, the server sends the Read Request Fin Ok.

Read OK (Server -> Client)

ValueLength (Bytes)
Number of Bytes following = 12 4
REQUEST_FIN = 74
IOCMD code (READ = 2)4
success= 04
otherwise the server reports an error.

Read Failed (Server -> Client)

ValueLength (Bytes)
Number of Bytes following 4
REQUEST_FIN = 74
IOCMD code (READ = 2)4
failure=<ErrorNumber!=0>4
Detail : UTF-8 UNICODElength is defined by UTF-8

The Vector Read Request

The client initiales the transaction by sending the ReadV Request Block, RVRB. The RVRB contains a sequence of number of bytes the client want to read from the connected dataset and file position.
ValueLength (Bytes)
8+nBlocks*124
READV=134
nBlocks4
Block1 Offset8
Block1 length4
..........
BlockN Offset8
BlockN length4

The server returns the Read Request Ack, indicating whether or not the Read Request is granted. The date returned as a continues sequence of bytes.

Granted (Server -> Client)

Value Length (Bytes)
Number of Bytes following = 12 4
REQUEST_ACK (6) 4
IOCMD code READV (13) 4
success= 0 4

The server asks the client to expect a new data connection from a different server. The client has to issue this command again after the new server has been successfully connected. The client must not send a DCAP CLOSE command on the current connection but should assume that the server is going to close this connection rather soon.

Value Length (Bytes)
Number of Bytes following = 12 4
REQUEST_ACK (6) 4
IOCMD code READV (13) 4
success= 0 4
EXPECT_NEW_CONNECTION 4

Denied (Server -> Client)

ValueLength (Bytes)
Number of Bytes following 4
REQUEST_ACK = 64
IOCMD code (READ=2,SEEK_AND_READ=11)4
failure=<ErrorNumber!=0>4
Detail : UTF-8 UNICODElength is defined by UTF-8
In case, the request is denied, the Read Request Sequence has ended. If the server replies with success, it will proceed by sending the Data Chain. The server will send exactly the number of bytes requested or error condition is triggered:

Data Chain : Server -> Client

ValueLength (Bytes)
Number of Bytes following = 4 4
DATA = 8 4
Number of Bytes following = <n1> 4
<user data> <n1>
Number of Bytes following = <n2> 4
<user data> <n2>
... ...
Number of Bytes following = -1 4
If no error was detected while sending the data to the client, the server sends the Read Request Fin Ok.

Read OK (Server -> Client)

ValueLength (Bytes)
Number of Bytes following = 12 4
REQUEST_FIN = 74
IOCMD code (READ = 2)4
success= 04
otherwise the server reports an error.

Read Failed (Server -> Client)

ValueLength (Bytes)
Number of Bytes following 4
REQUEST_FIN = 74
IOCMD code (READ = 2)4
failure=<ErrorNumber!=0>4
Detail : UTF-8 UNICODElength is defined by UTF-8

The Seek Request

Seek Request : Client -> Server

ValueLength (Bytes)
164
SEEK=34
(offset)8
(whence)4

Whence Meaning Code
SEEK_SET From Beginning of File 0
SEEK_CURRENT From Current File Position 1
SEEK_END From End Of File 2

Seek OK (Server -> Client)

ValueLength (Bytes)
Number of Bytes following = 20 4
REQUEST_ACK = 64
IOCMD code (SEEK = 3)4
success= 04
<New Location>8

Seek Failed (Server -> Client)

ValueLength (Bytes)
Number of Bytes following 4
REQUEST_ACK = 64
IOCMD code (SEEK = 3)4
failure=<ErrorNumber!=0>4
Detail : UTF-8 UNICODElength is defined by UTF-8

The Locate Request

Locate Request : Client -> Server

ValueLength (Bytes)
44
LOCATE=94

Locate OK (Server -> Client)

ValueLength (Bytes)
Number of Bytes following = 28 4
REQUEST_ACK = 64
IOCMD code (LOCATE = 9)4
success= 04
<File Size>8
<File Position>8

Locate Failed (Server -> Client)

ValueLength (Bytes)
Number of Bytes following 4
REQUEST_ACK = 64
IOCMD code (LOCATE = 9)4
failure=<ErrorNumber!=0>4
Detail : UTF-8 UNICODElength is defined by UTF-8

The Status Request

Status Request : Client -> Server

ValueLength (Bytes)
Number of Bytes following = 44
STATUS = 104

Status OK (Server -> Client)

ValueLength (Bytes)
Number of Bytes following = 12 4
REQUEST_ACK = 6 4
IOCMD code (STATUS = 10) 4
success= 0 4
protection (mode bits) 4
number of links 4
user id of owner 4
group id of owner 4
file size 8
time of last access 8
time of last modification 8
time of creation 8

Status Failed (Server -> Client)

Value Length (Bytes)
Number of Bytes following 4
REQUEST_ACK = 6 4
IOCMD code (STATUS = 10) 4
failure=<ErrorNumber!=0> 4
Detail : UTF-8 UNICODE length is defined by UTF-8

The Close Request

Close Request : Client -> Server (no checksum)

ValueLength (Bytes)
44
CLOSE = 44

Close Request : Client -> Server (client sends checksum)

ValueLength (Bytes)
data following = 204
CLOSE = 44
data following = 124
DCAP_DATA_SUM = 14
checksum type = DCAP_DEFAULT_SUM = ADLER32 = 14
checksum4

Close OK (Server -> Client)

ValueLength (Bytes)
Number of Bytes following = 12 4
REQUEST_ACK = 64
IOCMD code (CLOSE = 4)4
success= 04

Close Failed (Server -> Client)

ValueLength (Bytes)
Number of Bytes following 4
REQUEST_ACK = 64
IOCMD code (CLOSE = 4)4
failure=<ErrorNumber!=0>4
Detail : UTF-8 UNICODElength is defined by UTF-8

The Interrupt Request

The Interrupt Request is sent by the data receiving party. If the Data Chain is still in process, the sending party tries to stop the sending by transfering the current subblock and then ending the transfer by sending the '-1' data chain end block. In all other situations the Interrupt is simply ignored.

Interrupt Request : Client <-> Server

ValueLength (Bytes)
84
INTERRUPT=54
Interrupt Reason code4
Neither a Request Ack nor a Request Fin is send in response to an Interrupt Request.

Constants

KeywordValue
WRITE1
READ2
SEEK3
CLOSE4
INTERRUPT5
REQUEST_ACK6
REQUEST_FIN7
DATA8
LOCATE9
STATUS10
SEEK_AND_READ11
SEEK_AND_WRITE12
SEEK_SET0
SEEK_CURRENT1
SEEK_END2
DONT_SEND_MORE20
EXPECT_NEW_CONNECTION21

patrick.fuhrmann@desy.de, Last Updated : $Date: 2007/10/06 22:02:20 $