Download GLITE 3.0 USER GUIDE

Transcript
In addition to GFAL, there is also the possibility to use the RFIO’s C and C++ APIs, which also give applications the possibility to open and read a file remotely.
Nevertheless, RFIO presents several limitations in comparison to GFAL. First of all, it can only be used to
access those SEs or SRMs that support the RFIO protocol, while GFAL will deal with any of the other supported
protocols also. Secondly, RFIO does not understand GUIDs, LFNs or SURLs, and it can only operate with RFIO’s
TURLs.
Finally, as was explained previously, insecure RFIO can only be used in order to access files that are located
in the same local area network where the CE holding the job is located. In order to access or move files between
different sites, the user should use a different method. Of course, if the only way to remotely access a file is
insecure RFIO (as is the case for classic SEs or CASTOR), then GFAL calls will also use insecure RFIO as the
protocol for the interaction and therefore this last limitation will also apply.
Although direct use of RFIO’s APIs is discouraged, information on it and its APIs can be found in [39].
Example F.0.3
(Explicit interaction with the SRM using GFAL)
The following example program can be useful for copying a file that is stored in a MSS. It asks for the file to
be staged from tape to disk first, and only tries to copy it when the file has been migrated.
The program uses both the lcg util and the GFAL APIs. From lcg util, just the lcg cp call is used. From
GFAL, srm get, which requests a file to be staged from tape to disk, and srm get status, which checks the
status of the previous request, are used.
The source code follows:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <iostream>
#include <sstream>
// for the integer to string conversion
#include <unistd.h> // for the sleep function
#include <fstream>
// for the local file access
extern "C"{
#include "gfal_api.h"
#include "lcg_util.h"
}
using namespace std;
main(int argc, char ** argv){
/* Check arguments */
if ((argc < 2) || (argc > 2)) {
cerr << "Usage: " << argv[0] << " SURL\n";
exit (1);
}
CERN-LCG-GDEIS-722398
Manuals Series
Page 143