storage_tiering.cpp and data_verification_utilities.cpp both have an implementation of get_leaf_resources_string:
|
std::string storage_tiering::get_leaf_resources_string( |
|
const std::string& _resource_name) { |
|
std::string leaf_id_str; |
|
|
|
// if the resource has no children then simply return |
|
resource_ptr root_resc; |
|
error err = resc_mgr.resolve(_resource_name, root_resc); |
|
if(!err.ok()) { |
|
THROW(err.code(), err.result()); |
|
} |
|
|
|
std::vector<resource_manager::leaf_bundle_t> leaf_bundles = |
|
resc_mgr.gather_leaf_bundles_for_resc(_resource_name); |
|
for(const auto & bundle : leaf_bundles) { |
|
for(const auto & leaf_id : bundle) { |
|
leaf_id_str += |
|
"'" + boost::str(boost::format("%s") % leaf_id) + "',"; |
|
} // for |
|
} // for |
|
|
|
// if there is no hierarchy |
|
if(leaf_id_str.empty()) { |
|
rodsLong_t resc_id; |
|
resc_mgr.hier_to_leaf_id(_resource_name, resc_id); |
|
leaf_id_str = |
|
"'" + boost::str(boost::format("%s") % resc_id) + "',"; |
|
} |
|
|
|
return leaf_id_str; |
|
|
|
} // get_leaf_resources_string |
|
std::string get_leaf_resources_string( |
|
const std::string& _resource_name) { |
|
std::string leaf_id_str; |
|
|
|
// if the resource has no children then simply return |
|
irods::resource_ptr root_resc; |
|
irods::error err = resc_mgr.resolve(_resource_name, root_resc); |
|
if(!err.ok()) { |
|
THROW(err.code(), err.result()); |
|
} |
|
|
|
try { |
|
std::vector<irods::resource_manager::leaf_bundle_t> leaf_bundles = |
|
resc_mgr.gather_leaf_bundles_for_resc(_resource_name); |
|
for(const auto & bundle : leaf_bundles) { |
|
for(const auto & leaf_id : bundle) { |
|
leaf_id_str += |
|
"'" + boost::str(boost::format("%s") % leaf_id) + "',"; |
|
} // for |
|
} // for |
|
} |
|
catch( const irods::exception & _e ) { |
|
throw; |
|
} |
|
|
|
// if there is no hierarchy |
|
if(leaf_id_str.empty()) { |
|
rodsLong_t resc_id; |
|
resc_mgr.hier_to_leaf_id(_resource_name, resc_id); |
|
leaf_id_str = |
|
"'" + boost::str(boost::format("%s") % resc_id) + "',"; |
|
} |
|
|
|
return leaf_id_str; |
|
|
|
} // get_leaf_resources_string |
They are identical apart from an extraneous try-catch block (it just re-throws and does nothing else) in one of the implementations. Let's put this in a common place and point to one implementation. Can replace some boost in here, too (see #249 and #250).
storage_tiering.cppanddata_verification_utilities.cppboth have an implementation ofget_leaf_resources_string:irods_capability_storage_tiering/src/storage_tiering.cpp
Lines 181 to 211 in 526abf0
irods_capability_storage_tiering/src/data_verification_utilities.cpp
Lines 51 to 86 in 526abf0
They are identical apart from an extraneous try-catch block (it just re-throws and does nothing else) in one of the implementations. Let's put this in a common place and point to one implementation. Can replace some
boostin here, too (see #249 and #250).