irods
4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems. Fossies Dox: irods-4.2.8.tar.gz ("unofficial" and yet experimental doxygen-generated source code documentation) 
|
Go to the documentation of this file.
30 #include <boost/lexical_cast.hpp>
36 #include <sys/param.h>
44 #include <sys/types.h>
45 #if defined(osx_platform)
46 #include <sys/malloc.h>
57 #if defined(solaris_platform)
58 #include <sys/statvfs.h>
60 #if defined(linux_platform)
99 std::pair<std::string, irods::resource_ptr> child_pair;
100 if ( cmap_ref->
size() != 1 ) {
101 std::stringstream msg;
102 msg <<
"passthru_get_first_child_resc - Passthru resource can have 1 and only 1 child. This resource has " << cmap_ref->
size();
103 result =
ERROR( -1, msg.str() );
106 child_pair = cmap_ref->
begin()->second;
107 _resc = child_pair.second;
121 std::stringstream msg;
122 msg <<
" - resource context is invalid.";
123 return PASSMSG( msg.str(), ret );
138 result =
PASSMSG(
"bad params.", ret );
144 result =
PASSMSG(
"failed getting the first child resource pointer.", ret );
149 result =
PASSMSG(
"failed calling child create.", ret );
165 result =
PASSMSG(
"bad params.", ret );
171 result =
PASSMSG(
"failed getting the first child resource pointer.", ret );
175 result =
PASSMSG(
"passthru_file_open_plugin - failed calling child open.", ret );
192 result =
PASSMSG(
"bad params.", ret );
198 result =
PASSMSG(
"failed getting the first child resource pointer.", ret );
202 result =
PASSMSG(
"passthru_file_read_plugin - failed calling child read.", ret );
219 result =
PASSMSG(
"bad params.", ret );
225 result =
PASSMSG(
"failed getting the first child resource pointer.", ret );
229 result =
PASSMSG(
"passthru_file_write_plugin - failed calling child write.", ret );
244 result =
PASSMSG(
"passthru_file_close_plugin - bad params.", ret );
250 result =
PASSMSG(
"passthru_file_close_plugin - failed getting the first child resource pointer.", ret );
254 result =
PASSMSG(
"passthru_file_close_plugin - failed calling child close.", ret );
270 result =
PASSMSG(
"passthru_file_unlink_plugin - bad params.", ret );
276 result =
PASSMSG(
"passthru_file_unlink_plugin - failed getting the first child resource pointer.", ret );
280 result =
PASSMSG(
"passthru_file_unlink_plugin - failed calling child unlink.", ret );
290 struct stat* _statbuf ) {
296 result =
PASSMSG(
"passthru_file_stat_plugin - bad params.", ret );
302 result =
PASSMSG(
"passthru_file_stat_plugin - failed getting the first child resource pointer.", ret );
306 result =
PASSMSG(
"passthru_file_stat_plugin - failed calling child stat.", ret );
323 result =
PASSMSG(
"passthru_file_lseek_plugin - bad params.", ret );
329 result =
PASSMSG(
"passthru_file_lseek_plugin - failed getting the first child resource pointer.", ret );
333 result =
PASSMSG(
"passthru_file_lseek_plugin - failed calling child lseek.", ret );
348 result =
PASSMSG(
"passthru_file_mkdir_plugin - bad params.", ret );
354 result =
PASSMSG(
"passthru_file_mkdir_plugin - failed getting the first child resource pointer.", ret );
358 result =
PASSMSG(
"passthru_file_mkdir_plugin - failed calling child mkdir.", ret );
373 result =
PASSMSG(
"passthru_file_rmdir_plugin - bad params.", ret );
379 result =
PASSMSG(
"passthru_file_rmdir_plugin - failed getting the first child resource pointer.", ret );
383 result =
PASSMSG(
"passthru_file_rmdir_plugin - failed calling child rmdir.", ret );
398 result =
PASSMSG(
"passthru_file_opendir_plugin - bad params.", ret );
404 result =
PASSMSG(
"passthru_file_opendir_plugin - failed getting the first child resource pointer.", ret );
408 result =
PASSMSG(
"passthru_file_opendir_plugin - failed calling child opendir.", ret );
423 result =
PASSMSG(
"passthru_file_closedir_plugin - bad params.", ret );
429 result =
PASSMSG(
"passthru_file_closedir_plugin - failed getting the first child resource pointer.", ret );
433 result =
PASSMSG(
"passthru_file_closedir_plugin - failed calling child closedir.", ret );
449 result =
PASSMSG(
"passthru_file_readdir_plugin - bad params.", ret );
455 result =
PASSMSG(
"passthru_file_readdir_plugin - failed getting the first child resource pointer.", ret );
459 result =
PASSMSG(
"passthru_file_readdir_plugin - failed calling child readdir.", ret );
469 const char* _new_file_name ) {
475 result =
PASSMSG(
"passthru_file_rename_plugin - bad params.", ret );
481 result =
PASSMSG(
"passthru_file_rename_plugin - failed getting the first child resource pointer.", ret );
485 result =
PASSMSG(
"passthru_file_rename_plugin - failed calling child rename.", ret );
501 result =
PASSMSG(
"passthru_file_truncate_plugin - bad params.", ret );
507 result =
PASSMSG(
"passthru_file_truncate_plugin - failed getting the first child resource pointer.", ret );
511 result =
PASSMSG(
"passthru_file_truncate_plugin - failed calling child truncate.", ret );
526 result =
PASSMSG(
"passthru_file_getfs_freespace_plugin - bad params.", ret );
532 result =
PASSMSG(
"passthru_file_getfs_freespace_plugin - failed getting the first child resource pointer.", ret );
536 result =
PASSMSG(
"passthru_file_getfs_freespace_plugin - failed calling child freespace.", ret );
548 const char* _cache_file_name ) {
554 result =
PASSMSG(
"passthru_stage_to_cache_plugin - bad params.", ret );
560 result =
PASSMSG(
"passthru_stage_to_cache_plugin - failed getting the first child resource pointer.", ret );
564 result =
PASSMSG(
"passthru_stage_to_cache_plugin - failed calling child stagetocache.", ret );
576 const char* _cache_file_name ) {
582 result =
PASSMSG(
"passthru_file_sync_to_arch_plugin - bad params.", ret );
588 result =
PASSMSG(
"passthru_file_sync_to_arch_plugin - failed getting the first child resource pointer.", ret );
593 result =
PASSMSG(
"passthru_file_sync_to_arch_plugin - failed calling child synctoarch.", ret );
608 result =
PASSMSG(
"bad params.", ret );
614 result =
PASSMSG(
"failed getting the first child resource pointer.", ret );
619 result =
PASSMSG(
"failed calling child registered.", ret );
634 result =
PASSMSG(
"bad params.", ret );
640 result =
PASSMSG(
"failed getting the first child resource pointer.", ret );
645 result =
PASSMSG(
"failed calling child unregistered.", ret );
660 result =
PASSMSG(
"bad params.", ret );
666 result =
PASSMSG(
"failed getting the first child resource pointer.", ret );
671 result =
PASSMSG(
"failed calling child modified.", ret );
679 const std::string& _type,
685 std::vector< std::string > props;
693 irods::kvp_map_t::iterator itr = kvp.begin();
694 for( ; itr != kvp.end(); ++itr ) {
695 if (itr->first == _type) {
696 irods::error ret = irods::lexical_cast<double>(itr->second, _weight);
725 const std::string* _opr,
726 const std::string* _curr_host,
734 result =
PASSMSG(
"passthru_file_resolve_hierarchy - invalid resource context.", ret );
742 if ( !_out_parser ) {
751 std::string resc_name;
754 std::stringstream msg;
755 msg <<
"passthru_file_resolve_hierarchy - failed in get property for name";
756 return ERROR( -1, msg.str() );
766 return PASSMSG(
"passthru_file_resolve_hierarchy - failed getting the first child resource pointer.", ret );
782 double orig_vote = *_out_vote;
784 double read_weight = 1.0;
790 ( *_out_vote ) *= read_weight;
796 double write_weight = 1.0;
802 ( *_out_vote ) *= write_weight;
808 "passthru_file_resolve_hierarchy - [%s] : %f - %f",
830 for ( ; itr != cmap_ref->
end(); ++itr ) {
841 if ( !result.ok() ) {
842 return PASS( result );
853 const std::string* _opr ) {
864 for ( ; itr != cmap_ref->
end(); ++itr ) {
889 const std::string& _inst_name,
890 const std::string& _context ) :
895 if ( !_context.empty() ) {
902 "invalid context [%s] : %d",
910 double write_weight = boost::lexical_cast< double >( kvp_map[
WRITE_WEIGHT_KW ] );
913 catch (
const boost::bad_lexical_cast& ) {
914 std::stringstream msg;
915 msg <<
"failed to cast weight for write ["
927 double read_weight = boost::lexical_cast< double >( kvp_map[
READ_WEIGHT_KW ] );
930 catch (
const boost::bad_lexical_cast& ) {
931 std::stringstream msg;
932 msg <<
"failed to cast weight for read ["
966 using namespace irods;
986 function<error(plugin_context&,void*,int)>(
1001 function<error(plugin_context&, struct stat*)>(
1016 function<error(plugin_context&,struct rodsDirent**)>(
1021 function<error(plugin_context&, const char*)>(
1031 function<error(plugin_context&, long long, int)>(
1046 function<error(plugin_context&, const char*)>(
1051 function<error(plugin_context&, const char*)>(
1071 function<error(plugin_context&, const std::string*)>(
1081 function<error(plugin_context&,const std::string*, const std::string*, irods::hierarchy_parser*, float*)>(
void rodsLog(int level, const char *formatStr,...)
const std::string RESOURCE_NAME("resource_property_name")
const std::string RESOURCE_OP_STAT("resource_stat")
irods::error passthru_file_unregistered(irods::plugin_context &_ctx)
const std::string RESOURCE_CHECK_PATH_PERM("resource_property_check_path_perm")
const std::string RESOURCE_OP_MODIFIED("resource_modified")
irods::error passthru_file_rebalance(irods::plugin_context &_ctx)
const std::string RESOURCE_OP_CLOSEDIR("resource_closedir")
#define PASS(prev_error_)
boost::shared_ptr< resource > resource_ptr
irods::error passthru_file_sync_to_arch(irods::plugin_context &_ctx, const char *_cache_file_name)
const std::string RESOURCE_OP_RESOLVE_RESC_HIER("resource_resolve_hierarchy")
const std::string RESOURCE_OP_READDIR("resource_readdir")
irods::error passthru_file_create(irods::plugin_context &_ctx)
const std::string RESOURCE_OP_READ("resource_read")
const std::string RESOURCE_OP_FREESPACE("resource_freespace")
irods_hash_map::iterator iterator
irods::error passthru_file_closedir(irods::plugin_context &_ctx)
irods::error passthru_file_rmdir(irods::plugin_context &_ctx)
const std::string RESOURCE_OP_LSEEK("resource_lseek")
#define PASSMSG(message_, prev_error_)
irods::error passthru_file_modified(irods::plugin_context &_ctx)
error get(const std::string &_key, ValueType &_val)
resource(const std::string &_inst, const std::string &_ctx)
error set_property(const std::string &_key, const T &_val)
@ SYS_INVALID_INPUT_PARAM
irods::error passthru_file_unlink(irods::plugin_context &_ctx)
irods::error passthru_file_readdir(irods::plugin_context &_ctx, struct rodsDirent **_dirent_ptr)
virtual rsComm_t * comm()
const std::string RESOURCE_OP_TRUNCATE("resource_truncate")
const std::string RESOURCE_OP_RENAME("resource_rename")
const std::string OPEN_OPERATION("OPEN")
irods::error passthru_file_write(irods::plugin_context &_ctx, void *_buf, int _len)
passthru_resource(const std::string &_inst_name, const std::string &_context)
irods::error passthru_file_read(irods::plugin_context &_ctx, void *_buf, int _len)
irods::error passthru_file_stage_to_cache(irods::plugin_context &_ctx, const char *_cache_file_name)
virtual irods::plugin_property_map & prop_map()
irods::error passthru_file_notify(irods::plugin_context &_ctx, const std::string *_opr)
plugin_property_map properties_
error add_child(const std::string &_resc)
irods::error passthru_file_opendir(irods::plugin_context &_ctx)
const std::string RESOURCE_OP_CREATE("resource_create")
const std::string RESOURCE_OP_NOTIFY("resource_notify")
static irods::error capture_weight(irods::plugin_context &_ctx, const std::string &_type, double &_weight)
const std::string RESOURCE_CREATE_PATH("resource_property_create_path")
const std::string RESOURCE_OP_WRITE("resource_write")
irods::error passthru_file_open(irods::plugin_context &_ctx)
bool has_entry(KeyType _k) const
const std::string RESOURCE_OP_CLOSE("resource_close")
irods::error passthru_file_close(irods::plugin_context &_ctx)
irods::error passthru_file_mkdir(irods::plugin_context &_ctx)
const std::string RESC_CHILD_MAP_PROP("resource_child_map_property")
const std::string READ_WEIGHT_KW("read")
const std::string RESOURCE_OP_UNLINK("resource_unlink")
const std::string RESOURCE_OP_RMDIR("resource_rmdir")
#define ERROR(code_, message_)
const std::string RESOURCE_OP_UNREGISTERED("resource_unregistered")
irods::error passthru_check_params(irods::plugin_context &_ctx)
irods::resource * plugin_factory(const std::string &_inst_name, const std::string &_context)
const std::string RESOURCE_OP_REGISTERED("resource_registered")
error parse_kvp_string(const std::string &_str, kvp_map_t &_kvp, const std::string &_association=KVP_DEF_ASSOCIATION, const std::string &_delimeter=KVP_DEF_DELIMITER)
irods::error passthru_file_rename(irods::plugin_context &_ctx, const char *_new_file_name)
irods::error passthru_file_resolve_hierarchy(irods::plugin_context &_ctx, const std::string *_opr, const std::string *_curr_host, irods::hierarchy_parser *_out_parser, float *_out_vote)
irods::error passthru_get_first_child_resc(irods::plugin_property_map &_props, irods::resource_ptr &_resc)
const std::string RESOURCE_OP_MKDIR("resource_mkdir")
const std::string WRITE_WEIGHT_KW("write")
virtual const std::string rule_results()
const std::string RESOURCE_OP_OPENDIR("resource_opendir")
const std::string RESOURCE_OP_STAGETOCACHE("resource_stagetocache")
const std::string WRITE_OPERATION("WRITE")
error add_operation(const std::string &_op, std::function< error(plugin_context &)> _f)
virtual first_class_object_ptr fco()
const std::string RESOURCE_OP_SYNCTOARCH("resource_synctoarch")
irods::error passthru_file_stat(irods::plugin_context &_ctx, struct stat *_statbuf)
irods::error passthru_file_registered(irods::plugin_context &_ctx)
const std::string RESOURCE_OP_REBALANCE("resource_rebalance")
error set(const std::string &_key, const ValueType &_val)
std::map< std::string, std::string > kvp_map_t
const std::string RESOURCE_OP_OPEN("resource_open")
const std::string CREATE_OPERATION("CREATE")
irods::error passthru_file_truncate(irods::plugin_context &_ctx)
irods::error passthru_file_getfs_freespace(irods::plugin_context &_ctx)
irods::error passthru_file_lseek(irods::plugin_context &_ctx, long long _offset, int _whence)