_gfal_plugin_interface Struct Reference

#include <gfal_common_plugin_interface.h>

Data Fields

plugin_handle plugin_data
int priority
const char *(* getName )()
void(* plugin_delete )(plugin_handle plugin_data)
gboolean(* check_plugin_url )(plugin_handle plugin_data, const char *url, plugin_mode operation, GError **err)
int(* accessG )(plugin_handle plugin_data, const char *url, int mode, GError **err)
int(* chmodG )(plugin_handle plugin_data, const char *url, mode_t mode, GError **err)
int(* renameG )(plugin_handle plugin_data, const char *oldurl, const char *urlnew, GError **err)
int(* symlinkG )(plugin_handle plugin_data, const char *oldurl, const char *newold, GError **err)
int(* statG )(plugin_handle plugin_data, const char *url, struct stat *buf, GError **err)
int(* lstatG )(plugin_handle plugin_data, const char *url, struct stat *buf, GError **err)
ssize_t(* readlinkG )(plugin_handle plugin_data, const char *url, char *buff, size_t buffsiz, GError **)
gfal_file_handle(* opendirG )(plugin_handle plugin_data, const char *url, GError **err)
int(* closedirG )(plugin_handle plugin_data, gfal_file_handle dir_desc, GError **err)
struct dirent *(* readdirG )(plugin_handle plugin_data, gfal_file_handle dir_desc, GError **err)
int(* mkdirpG )(plugin_handle plugin_data, const char *url, mode_t mode, gboolean rec_flag, GError **err)
int(* rmdirG )(plugin_handle plugin_data, const char *url, GError **err)
gfal_file_handle(* openG )(plugin_handle plugin_data, const char *url, int flag, mode_t mode, GError **)
ssize_t(* readG )(plugin_handle, gfal_file_handle fd, void *buff, size_t count, GError **)
ssize_t(* writeG )(plugin_handle, gfal_file_handle fd, const void *buff, size_t count, GError **)
int(* closeG )(plugin_handle, gfal_file_handle fd, GError **)
off_t(* lseekG )(plugin_handle, gfal_file_handle fd, off_t offset, int whence, GError **err)
ssize_t(* preadG )(plugin_handle, gfal_file_handle fd, void *buff, size_t count, off_t offset, GError **)
ssize_t(* pwriteG )(plugin_handle, gfal_file_handle fd, const void *buff, size_t count, off_t offset, GError **)
int(* unlinkG )(plugin_handle plugin_data, const char *url, GError **err)
ssize_t(* getxattrG )(plugin_handle plugin_data, const char *url, const char *key, void *buff, size_t s_buff, GError **err)
ssize_t(* listxattrG )(plugin_handle plugin_data, const char *url, char *list, size_t s_list, GError **err)
int(* setxattrG )(plugin_handle plugin_data, const char *url, const char *key, const void *buff, size_t s_buff, int flags, GError **err)
int(* checksum_calcG )(plugin_handle data, const char *url, const char *check_type, char *checksum_buffer, size_t buffer_length, off_t start_offset, size_t data_length, GError **err)
int(* check_plugin_url_transfer )(plugin_handle plugin_data, const char *src, const char *dst, gfal_url2_check check)
int(* copy_file )(plugin_handle plugin_data, gfal2_context_t context, gfalt_params_t params, const char *src, const char *dst, GError **)
int(* bring_online )(plugin_handle plugin_data, const char *url, time_t pintime, time_t timeout, char *token, size_t tsize, int async, GError **err)
int(* bring_online_poll )(plugin_handle plugin_data, const char *url, const char *token, GError **err)
int(* release_file )(plugin_handle plugin_data, const char *url, const char *token, GError **err)
struct dirent *(* readdirppG )(plugin_handle plugin_data, gfal_file_handle dir_desc, struct stat *st, GError **err)

Detailed Description

Main interface that MUST be returned the entry point function "gfal_plugin_init" of each GFAL 2.0 plugin. the minimum calls are : getName, plugin_delete, check_plugin_url all the unused function pointers must be set to NULL


Field Documentation

int(* _gfal_plugin_interface::accessG)(plugin_handle plugin_data, const char *url, int mode, GError **err)

OPTIONAL : gfal_access function support

Parameters:
plugin_data : internal plugin data
url : URL for access checking
mode : mode to check ( see man 2 access )
err : Error report, the code field of err should be set to errno value when possible
Returns:
0 or -1 if error occures, err MUST be set in case of error
int(* _gfal_plugin_interface::bring_online)(plugin_handle plugin_data, const char *url, time_t pintime, time_t timeout, char *token, size_t tsize, int async, GError **err)

OPTIONAL: Requests to stage a file to the fist layer on a hierarchical SE.

Parameters:
plugin_data : internal plugin context
url : The url of the file
pintime : Time the file should stay in the cache
timeout : Operation timeout
token Where to put the retrieved token.
tsize The size of the buffer pointed by token.
async If true (!= 0), the call will not block. The caller will need to use bring_online_poll later.
err,: GError error support
Returns:
-1 on error (and err is set). 0 on success. 1 if the file has been staged.
int(* _gfal_plugin_interface::bring_online_poll)(plugin_handle plugin_data, const char *url, const char *token, GError **err)

OPTIONAL: Polling the bring_online request (mandatory if bring online is supported)

Parameters:
url The same URL as was passed to bring_online_async
token The token as returned by bring_online_async
Returns:
-1 on error (and err is set). 0 on success. 1 if the file has been staged.
gboolean(* _gfal_plugin_interface::check_plugin_url)(plugin_handle plugin_data, const char *url, plugin_mode operation, GError **err)

MANDATORY: Main critical function of the plugins, URL checker. check the availability of the given operation on this plugin for the given URL

This function is used by gfal 2.0 to determine which plugin need to be contacted for a given operation

Warning:
This function is a key function of GFAL 2.0, It MUST be as fast as possible.
Parameters:
plugin_data : internal plugin data
url : URL to check for the protocol compatibility
operation : operation to check
err : error handle, should be used ONLY in case of major failure.
Returns:
must return TRUE if the operation is compatible with this plugin, else FALSE
int(* _gfal_plugin_interface::check_plugin_url_transfer)(plugin_handle plugin_data, const char *src, const char *dst, gfal_url2_check check)

OPTIONAL: if transfer support, should return TRUE if the plugin is able to execute third party transfer from src to dst url

int(* _gfal_plugin_interface::checksum_calcG)(plugin_handle data, const char *url, const char *check_type, char *checksum_buffer, size_t buffer_length, off_t start_offset, size_t data_length, GError **err)

OPTIONAL : checksum calculation function support ( transfer consistency check, gfal_checksum )

Parameters:
plugin_data : internal plugin data
url : url of the file
check_type : string of the checksum type ( GFAL_CHKSUM_MD5, GFAL_CHKSUM_SHA1, .. )
start_offset : offset in the file where the checksum calculation will start ( 0 : from begining )
data_length : size of data to compute for the checksum after start_offset ( 0 -: full file )
checksum_buffer : buffer with checksum string as result
buffer_length : maximum buffer length
err : GError error support
Returns:
dynamically allocated checksum string if success, else NULL and err MUST be set error code MUST be ENOSUPPORT in case of :
  • checksum calculation with offset is not supported
  • the specified checksum algorithm is not supported
int(* _gfal_plugin_interface::chmodG)(plugin_handle plugin_data, const char *url, mode_t mode, GError **err)

OPTIONAL : gfal_chmod function support

Parameters:
plugin_data : internal plugin data
url : URL of the file
mode : mode to set
err : Error report, the code field of err should be set to errno value when possible
Returns:
0 or -1 if error occures, err MUST be set in case of error
int(* _gfal_plugin_interface::closedirG)(plugin_handle plugin_data, gfal_file_handle dir_desc, GError **err)

MANDATORY IF OPENDIR : gfal_closedir function support

Parameters:
plugin_data : internal plugin data
dir_desc : directory descriptor to use
err : Error report, the code field of err should be set to errno value when possible
Returns:
0 in case of success or -1 if error, err MUST be set in case of error
int(* _gfal_plugin_interface::closeG)(plugin_handle, gfal_file_handle fd, GError **)

MANDATORY IF OPEN : gfal_close function support

int(* _gfal_plugin_interface::copy_file)(plugin_handle plugin_data, gfal2_context_t context, gfalt_params_t params, const char *src, const char *dst, GError **)

OPTIONAL: if transfer support, Execute a filecopy operation for the given parameters

Parameters:
plugin_data : internal plugin context
gfal2_context_t context : gfal 2 handle
params,: parameters for the current transfer, see gfalt_params calls
src : source file to copy
dst : destination file
err : GError err report

MANDATORY : return a the string id of the plugin. string id must be short, constant and unique ( ex : "plugin_gridftp" )

Returns:
the constant identity string
ssize_t(* _gfal_plugin_interface::getxattrG)(plugin_handle plugin_data, const char *url, const char *key, void *buff, size_t s_buff, GError **err)

OPTIONAL : gfal_getxattr function support

Parameters:
plugin_data : internal plugin data
url : url of the file
key : key of the attribute to get
buff : buffer for the attribute content
s_buff : maximum buffer size
err : Error report, the code field of err should be set to errno value when possible
Returns:
size of the attribute in case of success or -1 if error occures, err MUST be set in case of error
ssize_t(* _gfal_plugin_interface::listxattrG)(plugin_handle plugin_data, const char *url, char *list, size_t s_list, GError **err)

OPTIONAL : gfal_listxattr function support

Parameters:
plugin_data : internal plugin data
url : url of the file
list : buffer for the list attribute content
s_buff : maximum buffer size
s_list : Error report, the code field of err should be set to errno value when possible
Returns:
size of the list in case of success or -1 if error occures, err MUST be set in case of error
off_t(* _gfal_plugin_interface::lseekG)(plugin_handle, gfal_file_handle fd, off_t offset, int whence, GError **err)

MANDATORY IF OPEN : gfal_lseek function support

int(* _gfal_plugin_interface::lstatG)(plugin_handle plugin_data, const char *url, struct stat *buf, GError **err)

OPTIONAL : gfal_lstat function support In case of non support for this function, calls to gfal_lstat are mapped to gfal_stat.

Parameters:
plugin_data : internal plugin data
url : url to stat
buf : informations of the file
err : Error report, the code field of err should be set to errno value when possible
Returns:
0 or -1 if error occures, err MUST be set in case of error
int(* _gfal_plugin_interface::mkdirpG)(plugin_handle plugin_data, const char *url, mode_t mode, gboolean rec_flag, GError **err)

OPTIONAL : gfal_mkdir function support

Parameters:
plugin_data : internal plugin data
url : url of the directory to create
mode : right mode of the created directory
rec_flag : recursive mode, if enabled the plugin MUST create the parent directories if needed, if the rec_flag is not supported by this plugin, the plugin MUST return a negative value and set the GError errcode to ENOENT
err : Error report, the code field of err should be set to errno value when possible
Returns:
0 in case of success or -1 if error occures, err MUST be set in case of error
gfal_file_handle(* _gfal_plugin_interface::opendirG)(plugin_handle plugin_data, const char *url, GError **err)

OPTIONAL : gfal_opendir function support

Parameters:
plugin_data : internal plugin data
url : url of directory to list
err : Error report, the code field of err should be set to errno value when possible
Returns:
gfa_file_handle in case of success or NULL if error, err MUST be set in case of error
gfal_file_handle(* _gfal_plugin_interface::openG)(plugin_handle plugin_data, const char *url, int flag, mode_t mode, GError **)

OPTIONAL : gfal_open function support

Parameters:
plugin_data : internal plugin data
url : url of the directory to open
flag : open flags
mode : mode of the file, in case of creation
err : Error report, the code field of err should be set to errno value when possible
Returns:
gfal_file_handle in case of success or NULL if error occures, err MUST be set in case of error

plugin reserved pointer, free to use for plugin's internal data, passed to any function

OPTIONAL : Last call before the unload of the plugin for the associated handle You can use this to clear your internal context

Parameters:
plugin_data : internal plugin data
ssize_t(* _gfal_plugin_interface::preadG)(plugin_handle, gfal_file_handle fd, void *buff, size_t count, off_t offset, GError **)

OPTIONAL : gfal_pread function support

Allow fast parallels read support, If not implemented, this function is simulated by GFAL 2.0

plugin priority SHOULD be defined to GFAL_PLUGIN_PRIORITY_DATA by default

ssize_t(* _gfal_plugin_interface::pwriteG)(plugin_handle, gfal_file_handle fd, const void *buff, size_t count, off_t offset, GError **)

OPTIONAL : gfal_pwriteG function support

Allow fast parallels write support, If not implemented, this function is simulated by GFAL 2.0

struct dirent*(* _gfal_plugin_interface::readdirG)(plugin_handle plugin_data, gfal_file_handle dir_desc, GError **err) [read]

MANDATORY IF OPENDIR : gfal_readdir function support

Parameters:
plugin_data : internal plugin data
dir_desc : directory descriptor to use
err : Error report, the code field of err should be set to errno value when possible
Returns:
dirent information in case of success or NULL if end of listing or error, err MUST be set in case of error
struct dirent*(* _gfal_plugin_interface::readdirppG)(plugin_handle plugin_data, gfal_file_handle dir_desc, struct stat *st, GError **err) [read]

OPTIONAL : gfal_readdirpp function support Allow directory listing + get meta-data in one operation

Parameters:
plugin_data : internal plugin data
dir_desc : directory descriptor to use
st : struct stat to fill
err : Error report, the code field of err should be set to errno value when possible
Returns:
dirent information in case of success or NULL if end of listing or error, err MUST be set in case of error
ssize_t(* _gfal_plugin_interface::readG)(plugin_handle, gfal_file_handle fd, void *buff, size_t count, GError **)

MANDATORY IF OPEN : gfal_read function support

ssize_t(* _gfal_plugin_interface::readlinkG)(plugin_handle plugin_data, const char *url, char *buff, size_t buffsiz, GError **)

OPTIONAL : gfal_readlink function support

Parameters:
plugin_data : internal plugin data
url : url to stat
buff : buffer for the readlink result
size_t : buffsize maximum size to fill in the buffer
err : Error report, the code field of err should be set to errno value when possible
Returns:
number of bytes in buff in case of success or -1 if error occures, err MUST be set in case of error
int(* _gfal_plugin_interface::release_file)(plugin_handle plugin_data, const char *url, const char *token, GError **err)

OPTIONAL: Releases a previously staged file (mandatory if bring online is supported)

Parameters:
plugin_data : internal plugin context
url : The url of the file
token,: The request token. If NULL,
err,: GError error support
int(* _gfal_plugin_interface::renameG)(plugin_handle plugin_data, const char *oldurl, const char *urlnew, GError **err)

OPTIONAL : gfal_rename function support

Parameters:
plugin_data : internal plugin data
oldurl : old url of the file
urlnew : new url of the file
err : Error report, the code field of err should be set to errno value when possible
Returns:
0 or -1 if error occures, err MUST be set in case of error
int(* _gfal_plugin_interface::rmdirG)(plugin_handle plugin_data, const char *url, GError **err)

OPTIONAL : gfal_rmdir function support

Parameters:
plugin_data : internal plugin data
url : url of the directory to delete
err : Error report, the code field of err should be set to errno value when possible
Returns:
0 in case of success or -1 if error occures, err MUST be set in case of error
int(* _gfal_plugin_interface::setxattrG)(plugin_handle plugin_data, const char *url, const char *key, const void *buff, size_t s_buff, int flags, GError **err)

OPTIONAL : gfal_setxattr function support

Parameters:
plugin_data : internal plugin data
url : url of the file
key : key of the attribute to set
buff : buffer for the attribute content
s_buff : maximum buffer size
flas : set/get flags
err : Error report, the code field of err should be set to errno value when possible
Returns:
0 or -1 if error occures, err MUST be set in case of error
int(* _gfal_plugin_interface::statG)(plugin_handle plugin_data, const char *url, struct stat *buf, GError **err)

MANDATORY : gfal_stat function support

Parameters:
plugin_data : internal plugin data
url : url to stat
buf : informations of the file
err : Error report, the code field of err should be set to errno value when possible
Returns:
0 or -1 if error occures, err MUST be set in case of error
int(* _gfal_plugin_interface::symlinkG)(plugin_handle plugin_data, const char *oldurl, const char *newold, GError **err)

OPTIONAL : gfal_symlink function support

Parameters:
plugin_data : internal plugin data
oldurl : old url of the file
urlnew : symlink to create
err : Error report, the code field of err should be set to errno value when possible
Returns:
0 or -1 if error occures, err MUST be set in case of error
int(* _gfal_plugin_interface::unlinkG)(plugin_handle plugin_data, const char *url, GError **err)

OPTIONAL : gfal_unlink function support

Parameters:
plugin_data : internal plugin data
url : url of the file
err : Error report, the code field of err should be set to errno value when possible
Returns:
0 in case of success or -1 if error occures, err MUST be set in case of error
ssize_t(* _gfal_plugin_interface::writeG)(plugin_handle, gfal_file_handle fd, const void *buff, size_t count, GError **)

MANDATORY IF OPEN : gfal_write function support


The documentation for this struct was generated from the following file:

Generated on 28 Nov 2013 for GFAL2 by  doxygen 1.6.1