![]() |
|
|||
File indexing completed on 2025-02-22 10:38:43
0001 /* 0002 * Copyright (c) CERN 2013-2017 0003 * 0004 * Copyright (c) Members of the EMI Collaboration. 2010-2013 0005 * See http://www.eu-emi.eu/partners for details on the copyright 0006 * holders. 0007 * 0008 * Licensed under the Apache License, Version 2.0 (the "License"); 0009 * you may not use this file except in compliance with the License. 0010 * You may obtain a copy of the License at 0011 * 0012 * http://www.apache.org/licenses/LICENSE-2.0 0013 * 0014 * Unless required by applicable law or agreed to in writing, software 0015 * distributed under the License is distributed on an "AS IS" BASIS, 0016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0017 * See the License for the specific language governing permissions and 0018 * limitations under the License. 0019 */ 0020 0021 #pragma once 0022 #ifndef _GFAL_COMMON_PLUGIN_INTERFACE_H_ 0023 #define _GFAL_COMMON_PLUGIN_INTERFACE_H_ 0024 0025 #if !defined(__GFAL2_H_INSIDE__) && !defined(__GFAL2_BUILD__) 0026 # warning "Direct inclusion of gfal2 headers is deprecated. Please, include only gfal_api.h" 0027 #endif 0028 0029 #include "gfal_common.h" 0030 #include "gfal_constants.h" 0031 #include "gfal_file_handle.h" 0032 #include <transfer/gfal_transfer_plugins.h> 0033 0034 #include <glib.h> 0035 #include <sys/stat.h> 0036 #include <sys/types.h> 0037 0038 #ifdef __cplusplus 0039 extern "C" 0040 { 0041 #endif 0042 0043 /** 0044 * Helper for the versioned plugin names 0045 */ 0046 #define GFAL2_PLUGIN_VERSIONED(plugin, version) plugin "-" version 0047 0048 /** 0049 * classical data access plugin 0050 */ 0051 #define GFAL_PLUGIN_PRIORITY_DATA 0; /**< The plugin provides IO */ 0052 #define GFAL_PLUGIN_PRIORITY_CATALOG 100; /**< The plugin provides namespace operations */ 0053 #define GFAL_PLUGIN_PRIORITY_CACHE 200; /**< The plugin provides a cache */ 0054 0055 0056 typedef struct _gfal_plugin_interface gfal_plugin_interface; 0057 typedef gpointer plugin_handle; 0058 0059 /** 0060 * Plugin check type 0061 */ 0062 typedef enum _plugin_mode { 0063 GFAL_PLUGIN_ALL=0, 0064 GFAL_PLUGIN_ACCESS, 0065 GFAL_PLUGIN_CHMOD, 0066 GFAL_PLUGIN_RENAME, 0067 GFAL_PLUGIN_SYMLINK, 0068 GFAL_PLUGIN_STAT, 0069 GFAL_PLUGIN_LSTAT, 0070 GFAL_PLUGIN_MKDIR, 0071 GFAL_PLUGIN_RMDIR, 0072 GFAL_PLUGIN_OPENDIR, /**< concat of opendir readdir, closedir*/ 0073 GFAL_PLUGIN_OPEN, /**< concat of open read, close*/ 0074 GFAL_PLUGIN_RESOLVE_GUID, 0075 GFAL_PLUGIN_GETXATTR, 0076 GFAL_PLUGIN_SETXATTR, 0077 GFAL_PLUGIN_LISTXATTR, 0078 GFAL_PLUGIN_READLINK, 0079 GFAL_PLUGIN_UNLINK, 0080 GFAL_PLUGIN_CHECKSUM, 0081 GFAL_PLUGIN_MKDIR_REC, 0082 GFAL_PLUGIN_BRING_ONLINE, 0083 GFAL_PLUGIN_ARCHIVE, 0084 GFAL_PLUGIN_QOS_CHECK_CLASSES, 0085 GFAL_PLUGIN_CHECK_FILE_QOS, 0086 GFAL_PLUGIN_CHECK_QOS_AVAILABLE_TRANSITIONS, 0087 GFAL_PLUGIN_CHECK_TARGET_QOS, 0088 GFAL_PLUGIN_CHANGE_OBJECT_QOS, 0089 GFAL_PLUGIN_TOKEN 0090 } plugin_mode; 0091 0092 /** 0093 * Check modes for transfers 0094 */ 0095 typedef enum _gfal_url2_check { 0096 GFAL_FILE_COPY, 0097 GFAL_BULK_COPY 0098 } gfal_url2_check; 0099 0100 /** 0101 * Prototype of the plugins entry point 0102 * 0103 * return gfal_plugin_interface must be allocated with \ĂȘef gfal_plugin_interface_new 0104 * 0105 * @param handle : gfal2_context_t of the current call 0106 * @param err : Error report in case of fatal error while the plugin load. 0107 * 0108 * */ 0109 typedef gfal_plugin_interface* (*gfal_plugin_init_t)(gfal2_context_t handle, GError** err); 0110 0111 0112 /** 0113 * @struct _gfal_plugin_interface 0114 * 0115 * Main interface that MUST be returned the entry point function "gfal_plugin_init" of each GFAL 2.0 plugin. 0116 * the minimum calls are : getName, plugin_delete, check_plugin_url 0117 * all the unused function pointers must be set to NULL 0118 */ 0119 struct _gfal_plugin_interface { 0120 //! @cond 0121 // internal gfal data: do not modify it 0122 void * gfal_data; 0123 //! @endcond 0124 0125 // plugin management 0126 0127 /** 0128 * plugin reserved pointer, free to use for plugin's internal data, passed to any function 0129 * 0130 * */ 0131 plugin_handle plugin_data; 0132 /** 0133 * plugin priority 0134 * SHOULD be defined to GFAL_PLUGIN_PRIORITY_DATA by default 0135 * */ 0136 int priority; 0137 /** 0138 * MANDATORY : return a the string id of the plugin. 0139 * string id must be short, constant and unique ( ex : "plugin_gridftp" ) 0140 * @return the constant identity string 0141 * */ 0142 const char* (*getName)(); 0143 /** 0144 * OPTIONAL : Last call before the unload of the plugin for the associated handle 0145 * You can use this to clear your internal context 0146 * @param plugin_data : internal plugin data 0147 */ 0148 void (*plugin_delete)(plugin_handle plugin_data); 0149 0150 /** 0151 * OPTIONAL: Check the availability of the given operation on this plugin for the given URL 0152 * 0153 * @warning This function is a key function of GFAL 2.0, It MUST be as fast as possible. 0154 * @param plugin_data : internal plugin data 0155 * @param url : URL to check for the protocol compatibility 0156 * @param operation : operation to check 0157 * @param err : error handle, should be used ONLY in case of major failure. 0158 * @return must return TRUE if the operation is compatible with this plugin, else FALSE 0159 */ 0160 gboolean (*check_plugin_url)(plugin_handle plugin_data, const char* url, plugin_mode operation, GError** err); 0161 0162 // FILE API 0163 0164 /** 0165 * OPTIONAL : gfal_access function support 0166 * @param plugin_data : internal plugin data 0167 * @param url : URL for access checking 0168 * @param mode : mode to check ( see man 2 access ) 0169 * @param err : Error report, the code field of err should be set to errno value when possible 0170 * @return 0 or -1 if error occurs, 0171 * err MUST be set in case of error 0172 * */ 0173 int (*accessG)(plugin_handle plugin_data, const char* url, int mode, GError** err); 0174 0175 /** 0176 * OPTIONAL : gfal_chmod function support 0177 * @param plugin_data : internal plugin data 0178 * @param url : URL of the file 0179 * @param mode : mode to set 0180 * @param err : Error report, the code field of err should be set to errno value when possible 0181 * @return 0 or -1 if error occurs, 0182 * err MUST be set in case of error 0183 * */ 0184 int (*chmodG)(plugin_handle plugin_data, const char * url, mode_t mode, GError** err); 0185 /** 0186 * OPTIONAL : gfal_rename function support 0187 * @param plugin_data : internal plugin data 0188 * @param oldurl : old url of the file 0189 * @param urlnew : new url of the file 0190 * @param err : Error report, the code field of err should be set to errno value when possible 0191 * @return 0 or -1 if error occurs, 0192 * err MUST be set in case of error 0193 * */ 0194 int (*renameG)(plugin_handle plugin_data, const char * oldurl, const char * urlnew, GError** err); 0195 /** 0196 * OPTIONAL : gfal_symlink function support 0197 * @param plugin_data : internal plugin data 0198 * @param oldurl : old url of the file 0199 * @param urlnew : symlink to create 0200 * @param err : Error report, the code field of err should be set to errno value when possible 0201 * @return 0 or -1 if error occurs, 0202 * err MUST be set in case of error 0203 * */ 0204 int (*symlinkG)(plugin_handle plugin_data, const char* oldurl, const char* newold, GError** err); 0205 0206 /** 0207 * OPTIONAL : gfal_stat function support 0208 * @param plugin_data : internal plugin data 0209 * @param url : url to stat 0210 * @param buf : informations of the file 0211 * @param err : Error report, the code field of err should be set to errno value when possible 0212 * @return 0 or -1 if error occurs, 0213 * err MUST be set in case of error 0214 * */ 0215 int (*statG)(plugin_handle plugin_data , const char* url, struct stat *buf, GError** err); 0216 0217 /** 0218 * OPTIONAL : gfal_lstat function support 0219 * In case of non support for this function, calls to @ref gfal_lstat are mapped to @ref gfal_stat. 0220 * 0221 * @param plugin_data : internal plugin data 0222 * @param url : url to stat 0223 * @param buf : informations of the file 0224 * @param err : Error report, the code field of err should be set to errno value when possible 0225 * @return 0 or -1 if error occurs, 0226 * err MUST be set in case of error 0227 * */ 0228 int (*lstatG)(plugin_handle plugin_data, const char* url, struct stat *buf, GError** err); 0229 /** 0230 * OPTIONAL : gfal_readlink function support 0231 * 0232 * @param plugin_data : internal plugin data 0233 * @param url : url to stat 0234 * @param buff : buffer for the readlink result 0235 * @param size_t : buffsize maximum size to fill in the buffer 0236 * @param err : Error report, the code field of err should be set to errno value when possible 0237 * @return number of bytes in buff in case of success or -1 if error occurs, 0238 * err MUST be set in case of error 0239 * */ 0240 ssize_t (*readlinkG)(plugin_handle plugin_data, const char* url, char* buff, size_t buffsiz, GError** ); 0241 0242 /** 0243 * OPTIONAL : gfal_opendir function support 0244 * 0245 * @param plugin_data : internal plugin data 0246 * @param url : url of directory to list 0247 * @param err : Error report, the code field of err should be set to errno value when possible 0248 * @return gfa_file_handle in case of success or NULL if error, 0249 * err MUST be set in case of error 0250 * */ 0251 gfal_file_handle (*opendirG)(plugin_handle plugin_data, const char* url, GError** err); 0252 0253 /** 0254 * MANDATORY IF OPENDIR : gfal_closedir function support 0255 * 0256 * @param plugin_data : internal plugin data 0257 * @param dir_desc : directory descriptor to use 0258 * @param err : Error report, the code field of err should be set to errno value when possible 0259 * @return 0 in case of success or -1 if error, 0260 * err MUST be set in case of error 0261 * */ 0262 int (*closedirG)(plugin_handle plugin_data, gfal_file_handle dir_desc, GError** err); 0263 0264 /** 0265 * MANDATORY IF OPENDIR : gfal_readdir function support 0266 * 0267 * @param plugin_data : internal plugin data 0268 * @param dir_desc : directory descriptor to use 0269 * @param err : Error report, the code field of err should be set to errno value when possible 0270 * @return dirent information in case of success or NULL if end of listing or error, 0271 * err MUST be set in case of error 0272 * */ 0273 struct dirent* (*readdirG)(plugin_handle plugin_data, gfal_file_handle dir_desc, GError** err); 0274 0275 /** 0276 * OPTIONAL : gfal_mkdir function support 0277 * 0278 * @param plugin_data : internal plugin data 0279 * @param url : url of the directory to create 0280 * @param mode : right mode of the created directory 0281 * @param rec_flag : recursive mode, if enabled the plugin MUST create the parent directories if needed, 0282 * if the rec_flag is not supported by this plugin, the plugin MUST return a negative value and set the GError errcode to ENOENT 0283 * @param err : Error report, the code field of err should be set to errno value when possible 0284 * @return 0 in case of success or -1 if error occurs, 0285 * err MUST be set in case of error 0286 * */ 0287 int (*mkdirpG)(plugin_handle plugin_data, const char* url, mode_t mode, gboolean rec_flag, GError** err); 0288 /** 0289 * OPTIONAL : gfal_rmdir function support 0290 * 0291 * @param plugin_data : internal plugin data 0292 * @param url : url of the directory to delete 0293 * @param err : Error report, the code field of err should be set to errno value when possible 0294 * @return 0 in case of success or -1 if error occurs, 0295 * err MUST be set in case of error 0296 * */ 0297 int (*rmdirG)(plugin_handle plugin_data, const char* url, GError** err); 0298 0299 // basic file operations 0300 /** 0301 * OPTIONAL : gfal_open function support 0302 * 0303 * @param plugin_data : internal plugin data 0304 * @param url : url of the directory to open 0305 * @param flag : open flags 0306 * @param mode : mode of the file, in case of creation 0307 * @param err : Error report, the code field of err should be set to errno value when possible 0308 * @return gfal_file_handle in case of success or NULL if error occurs, 0309 * err MUST be set in case of error 0310 * */ 0311 gfal_file_handle (*openG)(plugin_handle plugin_data, const char* url, int flag, mode_t mode, GError**); 0312 0313 /** 0314 * MANDATORY IF OPEN : gfal_read function support 0315 * 0316 * */ 0317 ssize_t (*readG)(plugin_handle, gfal_file_handle fd, void* buff, size_t count, GError**); 0318 0319 /** 0320 * MANDATORY IF OPEN : gfal_write function support 0321 * 0322 * */ 0323 ssize_t (*writeG)(plugin_handle, gfal_file_handle fd, const void* buff, size_t count, GError**); 0324 0325 /** 0326 * MANDATORY IF OPEN : gfal_close function support 0327 * 0328 * */ 0329 int (*closeG)(plugin_handle, gfal_file_handle fd, GError **); 0330 0331 /** 0332 * MANDATORY IF OPEN : gfal_lseek function support 0333 * 0334 * */ 0335 off_t (*lseekG)(plugin_handle, gfal_file_handle fd, off_t offset, int whence, GError** err); 0336 0337 // vector operations 0338 /** 0339 * OPTIONAL : gfal_pread function support 0340 * 0341 * Allow fast parallels read support, If not implemented, this function is simulated by GFAL 2.0 0342 * 0343 * */ 0344 ssize_t (*preadG)(plugin_handle, gfal_file_handle fd, void* buff, size_t count, off_t offset, GError**); 0345 /** 0346 * OPTIONAL : gfal_pwriteG function support 0347 * 0348 * Allow fast parallels write support, If not implemented, this function is simulated by GFAL 2.0 0349 * 0350 * */ 0351 ssize_t (*pwriteG)(plugin_handle, gfal_file_handle fd, const void* buff, size_t count, off_t offset, GError**); 0352 0353 0354 // remove operations 0355 /** 0356 * OPTIONAL : gfal_unlink function support 0357 * 0358 * @param plugin_data : internal plugin data 0359 * @param url : url of the file 0360 * @param err : Error report, the code field of err should be set to errno value when possible 0361 * @return 0 in case of success or -1 if error occurs, 0362 * err MUST be set in case of error 0363 * */ 0364 int (*unlinkG)(plugin_handle plugin_data, const char* url, GError** err); 0365 0366 // advanced attributes management 0367 /** 0368 * OPTIONAL : gfal_getxattr function support 0369 * 0370 * @param plugin_data : internal plugin data 0371 * @param url : url of the file 0372 * @param key : key of the attribute to get 0373 * @param buff : buffer for the attribute content 0374 * @param s_buff : maximum buffer size 0375 * @param err : Error report, the code field of err should be set to errno value when possible 0376 * @return size of the attribute in case of success or -1 if error occurs, 0377 * err MUST be set in case of error 0378 * */ 0379 ssize_t (*getxattrG)(plugin_handle plugin_data, const char* url, const char* key, 0380 void* buff, size_t s_buff, GError** err); 0381 /** 0382 * OPTIONAL : gfal_listxattr function support 0383 * 0384 * @param plugin_data : internal plugin data 0385 * @param url : url of the file 0386 * @param list : buffer for the list attribute content 0387 * @param s_buff : maximum buffer size 0388 * @param s_list : Error report, the code field of err should be set to errno value when possible 0389 * @return size of the list in case of success or -1 if error occurs, 0390 * err MUST be set in case of error 0391 * */ 0392 ssize_t (*listxattrG)(plugin_handle plugin_data, const char* url, char* list, size_t s_list, GError** err); 0393 0394 /** 0395 * OPTIONAL : gfal_setxattr function support 0396 * 0397 * @param plugin_data : internal plugin data 0398 * @param url : url of the file 0399 * @param key : key of the attribute to set 0400 * @param buff : buffer for the attribute content 0401 * @param s_buff : maximum buffer size 0402 * @param flas : set/get flags 0403 * @param err : Error report, the code field of err should be set to errno value when possible 0404 * @return 0 or -1 if error occurs, 0405 * err MUST be set in case of error 0406 * */ 0407 int (*setxattrG)(plugin_handle plugin_data, const char* url, const char* key, 0408 const void* buff , size_t s_buff, int flags, GError** err); 0409 0410 /** 0411 * OPTIONAL : checksum calculation function support ( transfer consistency check, gfal_checksum ) 0412 * 0413 * @param plugin_data : internal plugin data 0414 * @param url : url of the file 0415 * @param check_type : string of the checksum type ( \ref GFAL_CHKSUM_MD5, \ref GFAL_CHKSUM_SHA1, .. ) 0416 * @param start_offset : offset in the file where the checksum calculation will start ( 0 : from begining ) 0417 * @param data_length : size of data to compute for the checksum after start_offset ( 0 -: full file ) 0418 * @param checksum_buffer : buffer with checksum string as result 0419 * @param buffer_length : maximum buffer length 0420 * @param err : GError error support 0421 * @return dynamically allocated checksum string if success, else NULL and err MUST be set 0422 * error code MUST be ENOSYS in case of : 0423 * - checksum calculation with offset is not supported 0424 * - the specified checksum algorithm is not supported 0425 */ 0426 int (*checksum_calcG)(plugin_handle data, const char* url, const char* check_type, 0427 char * checksum_buffer, size_t buffer_length, 0428 off_t start_offset, size_t data_length, 0429 GError ** err); 0430 0431 // TRANSFER API 0432 /** 0433 * OPTIONAL: if transfer support, 0434 * should return TRUE if the plugin is able to execute third party transfer from src to dst url 0435 * 0436 */ 0437 int(*check_plugin_url_transfer)(plugin_handle plugin_data, gfal2_context_t, const char* src, const char* dst, gfal_url2_check check); 0438 0439 /** 0440 * 0441 * OPTIONAL: if transfer support, 0442 * Execute a filecopy operation for the given parameters 0443 * @param plugin_data : internal plugin context 0444 * @param gfal2_context_t context : gfal 2 handle 0445 * @param params: parameters for the current transfer, see gfalt_params calls 0446 * @param src : source file to copy 0447 * @param dst : destination file 0448 * @param err : GError err report 0449 * 0450 */ 0451 int (*copy_file)(plugin_handle plugin_data, gfal2_context_t context, gfalt_params_t params, const char* src, const char* dst, GError** ); 0452 0453 /** 0454 * 0455 * OPTIONAL: Requests to stage a file to the fist layer on a hierarchical SE. 0456 * @param plugin_data : internal plugin context 0457 * @param url : The url of the file 0458 * @param pintime : Time the file should stay in the cache 0459 * @param timeout : Operation timeout 0460 * @param token Where to put the retrieved token. 0461 * @param tsize The size of the buffer pointed by token. 0462 * @param async If true (!= 0), the call will not block. The caller will need 0463 * to use bring_online_poll later. 0464 * @param err: GError error support 0465 * @return -1 on error (and err is set). 0 on success. 1 if the file has been staged. 0466 */ 0467 int (*bring_online)(plugin_handle plugin_data, const char* url, 0468 time_t pintime, time_t timeout, 0469 char* token, size_t tsize, 0470 int async, 0471 GError** err); 0472 0473 /** 0474 * 0475 * OPTIONAL: Requests to stage a file to the fist layer on a hierarchical SE. 0476 * @param plugin_data : internal plugin context 0477 * @param url : The url of the file 0478 * @param metadata : Staging metadata 0479 * @param pintime : Time the file should stay in the cache 0480 * @param timeout : Operation timeout 0481 * @param token Where to put the retrieved token. 0482 * @param tsize The size of the buffer pointed by token. 0483 * @param async If true (!= 0), the call will not block. The caller will need 0484 * to use bring_online_poll later. 0485 * @param err: GError error support 0486 * @return -1 on error (and err is set). 0 on success. 1 if the file has been staged. 0487 */ 0488 int (*bring_online_v2)(plugin_handle plugin_data, 0489 const char* url, const char* metadata, 0490 time_t pintime, time_t timeout, 0491 char* token, size_t tsize, 0492 int async, 0493 GError** err); 0494 0495 /** 0496 * OPTIONAL: Polling the bring_online request (mandatory if bring online is supported) 0497 * @param url The same URL as was passed to bring_online_async 0498 * @param token The token as returned by bring_online_async 0499 * @return -1 on error (and err is set). 0 on success. 1 if the file has been staged. 0500 */ 0501 int (*bring_online_poll)(plugin_handle plugin_data, const char* url, 0502 const char* token, GError** err); 0503 0504 /** 0505 * OPTIONAL: Releases a previously staged file (mandatory if bring online is supported) 0506 * @param plugin_data : internal plugin context 0507 * @param url : The url of the file 0508 * @param token: The request token. If NULL, 0509 * @param err: GError error support 0510 */ 0511 int (*release_file)(plugin_handle plugin_data, const char* url, 0512 const char* token, 0513 GError** err); 0514 0515 /** 0516 * OPTIONAL : gfal_readdirpp function support 0517 * Allow directory listing + get meta-data in one operation 0518 * 0519 * @param plugin_data : internal plugin data 0520 * @param dir_desc : directory descriptor to use 0521 * @param st : struct stat to fill 0522 * @param err : Error report, the code field of err should be set to errno value when possible 0523 * @return dirent information in case of success or NULL if end of listing or error, 0524 * err MUST be set in case of error 0525 * */ 0526 struct dirent* (*readdirppG)(plugin_handle plugin_data, gfal_file_handle dir_desc, struct stat* st, GError** err); 0527 0528 0529 /** 0530 * 0531 * OPTIONAL: Requests to stage a file to the fist layer on a hierarchical SE. 0532 * @param plugin_data : internal plugin context 0533 * @param nbfiles : number of files 0534 * @param urls : The urls of the files 0535 * @param pintime : Time the file should stay in the cache 0536 * @param timeout : Operation timeout 0537 * @param token Where to put the retrieved token. 0538 * @param tsize The size of the buffer pointed by token. 0539 * @param async If true (!= 0), the call will not block. The caller will need 0540 * to use bring_online_poll later. 0541 * @param err: GError error support 0542 * @return -1 on error (and err is set). 0 on success. 1 if the file has been staged. 0543 */ 0544 int (*bring_online_list)(plugin_handle plugin_data, int nbfiles, const char* const* urls, 0545 time_t pintime, time_t timeout, 0546 char* token, size_t tsize, 0547 int async, 0548 GError** err); 0549 0550 /** 0551 * 0552 * OPTIONAL: Requests to stage a file to the fist layer on a hierarchical SE. 0553 * @param plugin_data : internal plugin context 0554 * @param nbfiles : number of files 0555 * @param urls : The urls of the files 0556 * @param metadata : Staging metadata array 0557 * @param pintime : Time the file should stay in the cache 0558 * @param timeout : Operation timeout 0559 * @param token Where to put the retrieved token. 0560 * @param tsize The size of the buffer pointed by token. 0561 * @param async If true (!= 0), the call will not block. The caller will need 0562 * to use bring_online_poll later. 0563 * @param err: GError error support 0564 * @return -1 on error (and err is set). 0 on success. 1 if the file has been staged. 0565 */ 0566 int (*bring_online_list_v2)(plugin_handle plugin_data, int nbfiles, 0567 const char* const* urls, const char* const* metadata, 0568 time_t pintime, time_t timeout, 0569 char* token, size_t tsize, 0570 int async, 0571 GError** err); 0572 0573 /** 0574 * OPTIONAL: Polling the bring_online request (mandatory if bring online is supported) 0575 * @param nbfiles : number of files 0576 * @param urls The same URLs as were passed to bring_online_async 0577 * @param token The token as returned by bring_online_async 0578 * @return -1 on error (and err is set). 0 on success. 1 if the file has been staged. 0579 */ 0580 int (*bring_online_poll_list)(plugin_handle plugin_data, int nbfiles, const char* const* urls, 0581 const char* token, GError** err); 0582 0583 /** 0584 * OPTIONAL: Releases a previously staged file (mandatory if bring online is supported) 0585 * @param plugin_data : internal plugin context 0586 * @param nbfiles : number of files in the list 0587 * @param url : The urls of the files 0588 * @param token: The request token. If NULL, 0589 * @param err: GError error support 0590 */ 0591 int (*release_file_list)(plugin_handle plugin_data, int nbfiles, const char* const* urls, 0592 const char* token, 0593 GError** err); 0594 0595 /** 0596 * OPTIONAL: Bulk deletion 0597 */ 0598 int (*unlink_listG)(plugin_handle plugin_data, int nbfiles, const char* const* uris, GError ** errors); 0599 0600 /** 0601 * OPTIONAL: allows clients to abort selective file requests from the asynchronous requests of any type 0602 * @param plugin_data : internal plugin context 0603 * @param nbfiles : number of files in the list 0604 * @param url : The urls of the files 0605 * @param token: The request token 0606 * @param err: GError error support 0607 */ 0608 int(*abort_files)(plugin_handle handle, int nbfiles, const char* const* uris, const char* token, GError ** err); 0609 0610 /** 0611 * OPTIONAL: copy nbfiles files 0612 * @param plugin_data : internal plugin context 0613 * @param context : gfal2 context 0614 * @param params: gfal2 transfer parameters 0615 * @param nbfiles: how many files are to be transferred 0616 * @param srcs: array of nbfiles sources 0617 * @param dsts: array of nbfiles destinations 0618 * @param checkums: array of nbfiles checksums. it can be NULL 0619 * @param op_error: Operation error 0620 * @param file_errors: Per file error 0621 */ 0622 int (*copy_bulk)(plugin_handle plugin_data, gfal2_context_t context, gfalt_params_t params, 0623 size_t nbfiles, const char* const* srcs, const char* const* dsts, const char* const* checksums, 0624 GError** op_error, GError*** file_errors); 0625 0626 /** 0627 * OPTIONAL: executed by the core before entering a copy, so a plugin can install its own 0628 * event listeners. 0629 */ 0630 int (*copy_enter_hook)(plugin_handle plugin_data, gfal2_context_t context, gfalt_params_t params, GError** error); 0631 0632 // QoS API 0633 0634 /** 0635 * OPTIONAL: Check what kind of QoS classes exist on the CDMI-enabled URL provided 0636 * 0637 * @param plugin_data : internal plugin data 0638 * @param url : CDMI-enabled URL to check for the protocol compatibility 0639 * @param type : CDMI-enabld type of QoS class 0640 * @param buff : buffer for the QoS classes content 0641 * @param s_buff : maximum buffer size 0642 * @param err : error handle, should be used ONLY in case of major failure. 0643 * @return number of bytes in buff in case of success or -1 if error occurs 0644 * 0645 * @note Result is provided as a comma-separated list of available QoS classes 0646 */ 0647 ssize_t (*check_qos_classes)(plugin_handle plugin_data, const char* url, const char* type, 0648 char* buff, size_t s_buff, GError** err); 0649 0650 /** 0651 * OPTIONAL: Check the QoS of a file with the CDMI-enabled url provided 0652 * 0653 * @param plugin_data : internal plugin data 0654 * @param url : CDMI-enabled URL to check for the protocol compatibility 0655 * @param buff : buffer for the QoS class content 0656 * @param s_buff : maximum buffer size 0657 * @param err : error handle, should be used ONLY in case of major failure. 0658 * @return number of bytes in buff in case of success or -1 if error occurs 0659 */ 0660 ssize_t (*check_file_qos)(plugin_handle plugin_data, const char* url, char* buff, size_t s_buff, GError** err); 0661 0662 /** 0663 * OPTIONAL: Check the available transitions of a QoS class to other QoS classes 0664 * 0665 * @param plugin_data : internal plugin data 0666 * @param qos_class_url : CDMI-enabled URL of QoS class 0667 * @param buff : buffer for the QoS class transitions content 0668 * @param s_buff : maximum buffer size 0669 * @param err : error handle, should be used ONLY in case of major failure. 0670 * @return number of bytes in buff in case of success or -1 if error occurs 0671 * 0672 * @note Result is provided as comma-separated list of available QoS class transitions 0673 */ 0674 ssize_t (*check_qos_available_transitions)(plugin_handle plugin_data, const char* qos_class_url, 0675 char* buff, size_t s_buff, GError** err); 0676 0677 /** 0678 * OPTIONAL: Check the target QoS of an entity 0679 * 0680 * @param plugin_data : internal plugin data 0681 * @param url : CDMI-enabled URL of an entity 0682 * @param buff : buffer for the target QoS class content 0683 * @param s_buff : maximum buffer size 0684 * @param err : error handle, should be used ONLY in case of major failure. 0685 * @return number of bytes in buff in case of success or -1 if error occurs 0686 */ 0687 ssize_t (*check_target_qos)(plugin_handle plugin_data, const char* url, char* buff, size_t s_buff, GError** err); 0688 0689 /** 0690 * OPTIONAL: Check the QoS of a file with the CDMI-enabled url provided 0691 * 0692 * @param plugin_data : internal plugin data 0693 * @param url : CDMI-enabled URL of an entity 0694 * @param target_qos: the requested target QoS class 0695 * @param err : error handle, should be used ONLY in case of major failure. 0696 * @return 0 or -1 if error occurs 0697 */ 0698 int (*change_object_qos)(plugin_handle plugin_data, const char* url, const char* target_qos, GError** err); 0699 0700 // ARCHIVE API 0701 0702 /** 0703 * OPTIONAL: Polling the archive request (mandatory if archiving is supported) 0704 * 0705 * @param plugin_data: internal plugin data 0706 * @param url: the URL for which to check archive status 0707 * @param err: error handle 0708 * @return -1 on error (and err is set). 0 on success. 1 if the file has been archived. 0709 */ 0710 int (*archive_poll)(plugin_handle plugin_data, const char* url, GError** err); 0711 0712 /** 0713 * OPTIONAL: Polling the archive request (mandatory if archiving is supported) 0714 * 0715 * @param plugin_data: internal plugin data 0716 * @param nbfiles: number of files 0717 * @param urls: the URLs for which to check archive status 0718 * @param err: error handle 0719 * @return -1 on error (and err is set). 0 on success. 1 if the files have been archived. 0720 * 2 if some files have bene archived, others encountered errors 0721 */ 0722 int (*archive_poll_list)(plugin_handle plugin_data, int nbfiles, 0723 const char* const* urls, GError** err); 0724 0725 // TOKEN API 0726 0727 /** 0728 * OPTIONAL: Retrieve a token from Storage Element for a given resource 0729 * 0730 * @param plugin_data: internal plugin data 0731 * @param url: the URL of the resource 0732 * @param issuer: the token issuer endpoint (optional) 0733 * @param write_access: write access flag 0734 * @param validity: token validity time in minutes 0735 * @param activities: array of activities for access request 0736 * @param buff : buffer for the token content 0737 * @param s_buff : maximum buffer size 0738 * @param err : error handle 0739 * @return number of bytes in buff in case of success or -1 if error occurs 0740 */ 0741 ssize_t (*token_retrieve)(plugin_handle plugin_data, const char* url, const char* issuer, 0742 gboolean write_access, unsigned validity, const char* const* activities, 0743 char* buff, size_t s_buff, GError** err); 0744 0745 // reserved for future usage 0746 //! @cond 0747 void* future[4]; 0748 //! @endcond 0749 }; 0750 0751 /** 0752 * Trigger plugin instantiation from the client code 0753 * The passed interface is copied, so you can, if needed, free it after the call 0754 */ 0755 int gfal2_register_plugin(gfal2_context_t handle, const gfal_plugin_interface* ifce, 0756 GError** error); 0757 0758 0759 // internal API for inter plugin communication 0760 //! @cond 0761 int gfal_plugins_accessG(gfal2_context_t handle, const char* path, int mode, GError** err); 0762 int gfal_plugin_rmdirG(gfal2_context_t handle, const char* path, GError** err); 0763 ssize_t gfal_plugin_readlinkG(gfal2_context_t handle, const char* path, char* buff, size_t buffsiz, GError** err); 0764 0765 0766 int gfal_plugin_chmodG(gfal2_context_t handle, const char* path, mode_t mode, GError** err); 0767 int gfal_plugin_statG(gfal2_context_t handle,const char* path, struct stat* st, GError** err); 0768 int gfal_plugin_renameG(gfal2_context_t handle, const char* oldpath, const char* newpath, GError** err); 0769 int gfal_plugin_symlinkG(gfal2_context_t handle, const char* oldpath, const char* newpath, GError** err); 0770 int gfal_plugin_lstatG(gfal2_context_t handle,const char* path, struct stat* st, GError** err); 0771 int gfal_plugin_mkdirp(gfal2_context_t handle, const char* path, mode_t mode, gboolean pflag, GError** err); 0772 0773 0774 gfal_file_handle gfal_plugin_opendirG(gfal2_context_t handle, const char* name, GError** err); 0775 struct dirent* gfal_plugin_readdirppG(gfal2_context_t handle, gfal_file_handle fh, struct stat* st, GError** err); 0776 int gfal_plugin_closedirG(gfal2_context_t handle, gfal_file_handle fh, GError** err); 0777 struct dirent* gfal_plugin_readdirG(gfal2_context_t handle, gfal_file_handle fh, GError** err); 0778 0779 0780 gfal_file_handle gfal_plugin_openG(gfal2_context_t handle, const char * path, int flag, mode_t mode, GError ** err); 0781 int gfal_plugin_closeG(gfal2_context_t handle, gfal_file_handle fh, GError** err); 0782 int gfal_plugin_writeG(gfal2_context_t handle, gfal_file_handle fh, void* buff, size_t s_buff, GError** err); 0783 int gfal_plugin_lseekG(gfal2_context_t handle, gfal_file_handle fh, off_t offset, int whence, GError** err); 0784 int gfal_plugin_readG(gfal2_context_t handle, gfal_file_handle fh, void* buff, size_t s_buff, GError** err); 0785 0786 ssize_t gfal_plugin_preadG(gfal2_context_t handle, gfal_file_handle fh, void* buff, size_t s_buff, off_t offset, GError** err); 0787 ssize_t gfal_plugin_pwriteG(gfal2_context_t handle, gfal_file_handle fh, void* buff, size_t s_buff, off_t offset, GError** err); 0788 0789 0790 int gfal_plugin_unlinkG(gfal2_context_t handle, const char* path, GError** err); 0791 0792 0793 ssize_t gfal_plugin_getxattrG(gfal2_context_t, const char*, const char*, void* buff, size_t s_buff, GError** err); 0794 ssize_t gfal_plugin_listxattrG(gfal2_context_t, const char*, char* list, size_t s_list, GError** err); 0795 int gfal_plugin_setxattrG(gfal2_context_t, const char*, const char*, const void*, size_t, int, GError**); 0796 0797 int gfal_plugin_bring_onlineG(gfal2_context_t handle, const char* uri, 0798 time_t pintime, time_t timeout, 0799 char* token, size_t tsize, 0800 int async, 0801 GError ** err); 0802 0803 int gfal_plugin_bring_online_v2G(gfal2_context_t handle, 0804 const char* uri, const char* metadata, 0805 time_t pintime, time_t timeout, 0806 char* token, size_t tsize, 0807 int async, 0808 GError ** err); 0809 0810 int gfal_plugin_bring_online_pollG(gfal2_context_t handle, const char* uri, 0811 const char* token, GError ** err); 0812 0813 int gfal_plugin_release_fileG(gfal2_context_t handle, const char* uri, 0814 const char* token, GError ** err); 0815 0816 int gfal_plugin_bring_online_listG(gfal2_context_t handle, int nbfiles, const char* const* uris, 0817 time_t pintime, time_t timeout, 0818 char* token, size_t tsize, 0819 int async, 0820 GError ** err); 0821 0822 int gfal_plugin_bring_online_list_v2G(gfal2_context_t handle, int nbfiles, 0823 const char* const* uris, const char* const* metadata, 0824 time_t pintime, time_t timeout, 0825 char* token, size_t tsize, 0826 int async, 0827 GError ** err); 0828 0829 int gfal_plugin_bring_online_poll_listG(gfal2_context_t handle, int nbfiles, const char* const* uris, 0830 const char* token, GError ** err); 0831 0832 int gfal_plugin_release_file_listG(gfal2_context_t handle, int nbfiles, const char* const* uris, 0833 const char* token, GError ** err); 0834 0835 int gfal_plugin_unlink_listG(gfal2_context_t handle, int nbfiles, const char* const* uris, GError ** errors); 0836 0837 int gfal_plugin_abort_filesG(gfal2_context_t handle, int nbfiles, const char* const* uris, const char* token, GError ** err); 0838 0839 ssize_t gfal_plugin_qos_check_classes(gfal2_context_t handle, const char* url, const char* type, 0840 char* buff, size_t s_buff, GError** err); 0841 ssize_t gfal_plugin_check_file_qos(gfal2_context_t handle, const char* url, char* buff, size_t s_buff, GError** err); 0842 ssize_t gfal_plugin_check_qos_available_transitions(gfal2_context_t handle, const char* qos_class_url, 0843 char* buff, size_t s_buff, GError** err); 0844 ssize_t gfal_plugin_check_target_qos(gfal2_context_t handle, const char* url, char* buff, size_t s_buff, GError** err); 0845 int gfal_plugin_change_object_qos(gfal2_context_t handle, const char* url, const char* target_qos, GError** err); 0846 0847 int gfal_plugin_archive_pollG(gfal2_context_t handle, const char* uri, GError ** err); 0848 int gfal_plugin_archive_poll_listG(gfal2_context_t handle, int nbfiles, const char* const* uris, 0849 GError ** err); 0850 0851 ssize_t gfal_plugin_token_retrieveG(gfal2_context_t handle, const char* url, const char* issuer, 0852 gboolean write_access, unsigned validity, const char* const* activities, 0853 char* buff, size_t s_buff, GError** err); 0854 0855 //! @endcond 0856 0857 #ifdef __cplusplus 0858 } 0859 #endif 0860 0861 0862 #endif /* GFAL_COMMON_PLUGIN_INTERFACE_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |