"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/core/include/apiHandler.hpp" between
irods-4.2.5.tar.gz and irods-4.2.6.tar.gz

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.

apiHandler.hpp  (irods-4.2.5):apiHandler.hpp  (irods-4.2.6)
skipping to change at line 28 skipping to change at line 28
#include "irods_stacktrace.hpp" #include "irods_stacktrace.hpp"
#include "boost/shared_ptr.hpp" #include "boost/shared_ptr.hpp"
#include "boost/any.hpp" #include "boost/any.hpp"
#include "irods_pack_table.hpp" #include "irods_pack_table.hpp"
#include "irods_re_namespaceshelper.hpp" #include "irods_re_namespaceshelper.hpp"
#include "irods_re_plugin.hpp" #include "irods_re_plugin.hpp"
#include "irods_re_ruleexistshelper.hpp" #include "irods_re_ruleexistshelper.hpp"
#include <functional> #include <functional>
#include <utility>
#include <type_traits>
namespace irods { namespace irods {
// NOOP function for clearInStruct // NOOP function for clearInStruct
void clearInStruct_noop( void* ); void clearInStruct_noop( void* );
struct apidef_t { struct apidef_t {
// =-=-=-=-=-=-=- // =-=-=-=-=-=-=-
// attributes // attributes
int apiNumber; /* the API number */ int apiNumber; /* the API number */
skipping to change at line 65 skipping to change at line 67
* client */ * client */
const char * operation_name; const char * operation_name;
std::function<void( void* )> clearInStruct; // free input struct func tion std::function<void( void* )> clearInStruct; // free input struct func tion
int(*call_wrapper)(...); // wraps the api call for type casting int(*call_wrapper)(...); // wraps the api call for type casting
}; // struct apidef_t }; // struct apidef_t
template <typename Integer,
typename std::enable_if_t<std::is_integral<Integer>::value, int> =
0
>
bool is_acceptable_error(Integer error_code) {
static const std::vector<Integer> acceptable_errors {
SYS_NO_HANDLER_REPLY_MSG //... others as necessary
};
return std::any_of( acceptable_errors.begin(), acceptable_errors.end(),
[error_code](auto listed)->bool { return listed == error_code; }
);
}
template < typename... types_t > template < typename... types_t >
class api_call_adaptor { class api_call_adaptor {
std::function<int(rsComm_t*, types_t...)> fcn_; std::function<int(rsComm_t*, types_t...)> fcn_;
public: public:
api_call_adaptor( std::function<int(rsComm_t*, types_t...)> _fcn ): fcn_ (_fcn) { api_call_adaptor( std::function<int(rsComm_t*, types_t...)> _fcn ): fcn_ (_fcn) {
} }
irods::error operator()( irods::plugin_context&, rsComm_t* _comm, types_ t... _t ) { irods::error operator()( irods::plugin_context&, rsComm_t* _comm, types_ t... _t ) {
int ret = fcn_( _comm, _t... ); int ret = fcn_( _comm, _t... );
if( ret >= 0 ) { if( ret >= 0 ) {
skipping to change at line 166 skipping to change at line 180
if(!except_err.ok()) { if(!except_err.ok()) {
irods::log(PASS(except_err)); irods::log(PASS(except_err));
} }
return pre_err.code(); return pre_err.code();
} }
std::function<error(irods::plugin_context&, rsComm_t*,ty pes_t...)> adapted_fcn{ std::function<error(irods::plugin_context&, rsComm_t*,ty pes_t...)> adapted_fcn{
api_call_adaptor<types_t...>(fcn) }; api_call_adaptor<types_t...>(fcn) };
error op_err = adapted_fcn( ctx, _comm, forward<types_t> (_t)...); error op_err = adapted_fcn( ctx, _comm, forward<types_t> (_t)...);
if(!op_err.ok()) {
if (!op_err.ok() && !is_acceptable_error(op_err.code())
) {
// if the operation fails, invoke the exception pep // if the operation fails, invoke the exception pep
error except_err = invoke_policy_enforcement_point( error except_err = invoke_policy_enforcement_point(
re_ctx_mgr, re_ctx_mgr,
ctx, ctx,
operation_name, operation_name,
"except", "except",
forward<types_t>(_t)...); forward<types_t>(_t)...);
if(!except_err.ok()) { if(!except_err.ok()) {
irods::log(PASS(except_err)); irods::log(PASS(except_err));
} }
 End of changes. 3 change blocks. 
1 lines changed or deleted 18 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)