100 likes | 265 Views
gfal-srm-ifce library. CERN 8 . 12 .2010. Todor Manev tmanev@gmail.com. Current situation. GFAL library – Srm ifce is in one file srm2_2_ifce.c FTS – srm-util-cpp library written in C++. Why, creating common library?. Advantages: easier to maintain easier to add new features
E N D
gfal-srm-ifce library CERN 8.12.2010 Todor Manevtmanev@gmail.com
Current situation • GFAL library – Srm ifce is in one file srm2_2_ifce.c • FTS – srm-util-cpp library written in C++
Why, creating common library? • Advantages: • easier to maintain • easier to add new features • better testing functionalities • better documentation • Disadvantages: • introducing new bugs
Source/header files in the library • gfal_srm_ifce.h – contains all the necessary SRM method definitions of the API • gfal_srm_types.h - contains all the structure definitions used in the API. • srm_util.c/h – common functionality used in the library (back off logic, error handling, etc.) • srm_dependencies.c/h – contain all srm gsoap function calls used in the interface. This is used for dependency injection and better unit testing of the code. • srm_version_wrapper.c -contains wrapper of the srm interface for all of the function calls. Depending on the context->version variable the proper srm version function is called. All the functions follow the same template. (library supports only srm version 2.2). • srmv2_sync_wrapper.c - contains wrapper of the srm interface for all of the synchronous function calls. All the functions follow the same template. (prepeare_to_put, prepare_to_get, bring_online, ls). • srmv2_async_wrapper.c - contains wrapper of the srm interface for all of the asynchronous function calls.For example: ls_async and status_of_ls_async. All the functions follow the same template.
Srm v2.2. implemented functions • Grouped according to the SRM Interface Specification • srmv2_data_transfer_functions.c - Contains definitions of the data transfer functions: PrepareToGet, StatusOfGetRequest, PrepareToPut, StatusOfPrepareRequest, PutDone, ReleaseFiles, BringOnline, StatusOfBringOnlineRequest, AbortFiles, AbortRequest • srmv2_directory_functions.c - Contains definitions of the directory functions: Ls,StatusOfLs, Rm, RmDir, MkDir • srmv2_discovery_functions.c - Contains definitions of the discovery functions: Ping • srmv2_permission_functions.c - Contains definitions of the permission functions: SetPermission, GetPermission, CheckPermission • srmv2_space_management_functions.c - Contains definitions of the space management functions: GetSpaceMetaData, GetSpaceTokens , ReserveSpace, ReleaseSpace, PurgeFromSpace
Testing • There are 2 type of tests of the library encapsulated in 2 executables. • gfal_srm_ifce_unittest – this binary uses CCHECK – C unit test framework to execute, library functional tests, CCHECK allows each test to be run in a separate process and produces a nice summery, for easier debug of the unit tests it is better to switch off this functionality using the CK_NOFORK option. The unit tests cover most of the functions and return calls. • NOTE: The unit tests are executed in ETICS in the nightly builds, so be careful and make sure that they are successful upon submission of any code changes. • gfal_srm_ifce_systemtest – this binary uses CCHECK as well and executes various srm calls to real endpoints. This tests uses the following CLI : lcg_cr, globus_url_copy. So for proper work of these tests make sure that there is a valid proxy and you have access to the endpoints. • gfal_srm_ifce_version – shows the version of the library.
Building the library • Etics build • etics-get-project org.glite • etics-checkout --config org.glite.data.srm-ifce.HEAD --project org.glite --project-config glite_3_2_cert --forcecheckout org.glite.data.srm-ifce • etics-build --config org.glite.data.srm-ifce.HEAD --target postpublish org.glite.data.srm-ifce • Build without etics • The library depends on : • org.glite.security.cgsi-gsoap-2.7 (depends on globus) • gsoap v. 2.7.6b • c-check • org.glite.data.build-common-cpp (m4 macro) • svn co http://svnweb.cern.ch/guest/lcgutil/srm-ifce/trunk org.glite.data.srm-ifce • mkdir -p src/autogen build; aclocal -I ${m4.macros.location}; libtoolize --force; autoheader; automake --foreign --add-missing --copy; autoconf • cd build; ${src.location}/configure --enable-debug --enable-wall --prefix=${prefix} --with-version=${version} --with-release=${age} --with-gsoap-location=${gsoap.location} --with-gsoap-version=${gsoap.version} --with-globus-prefix=${globus.location} --with-globus-thr-flavor=${globus.dbg.thr.flavor} --with-globus-nothr-flavor=${globus.dbg.nothr.flavor} --with-cgsi-gsoap-location=${org.glite.security.cgsi-gsoap-2.7.location} --with-ccheck-location=${c-check.location} • make -C build all
Implementation example of srmLs // defining context and input/output parameters struct srm_context context; struct srm_ls_input ls_input; struct srm_ls_output ls_output; // initializing context and input parameters srm_context_init(&context,req->endpoint,errbuf,errbufsz,gfal_verbose); // set input parameters ls_input.nbfiles = req->nbfiles; ls_input.surls = req->surls; ls_input.numlevels = req->srmv2_lslevels; ls_input.offset = &(req->srmv2_lsoffset); ls_input.count = req->srmv2_lscount; // srmlssynchroneous call ret = srm_ls(&context,&ls_input,&ls_output); // copy output parameters req->srmv2_mdstatuses = ls_output.statuses; req->srmv2_token = ls_output.token;
For more information • SRM Interface Specification version 2.2 here:https://sdm.lbl.gov/srm-wg/doc/SRM.v2.2.html • gfal-srm-ifce library specification here:https://svnweb.cern.ch/trac/lcgutil/browser/srm-ifce/docs • source code:https://svnweb.cern.ch/trac/lcgutil/browser/srm-ifce/trunk