Пример #1
0
    // =-=-=-=-=-=-=-
    // pass_thru_file_rebalance - code which would rebalance the subtree
    irods::error pass_thru_file_rebalance(
        irods::resource_plugin_context& _ctx ) {
        // =-=-=-=-=-=-=-
        // forward request for rebalance to children
        irods::error result = SUCCESS();
        irods::resource_child_map::iterator itr = _ctx.child_map().begin();
        for ( ; itr != _ctx.child_map().end(); ++itr ) {
            irods::error ret = itr->second.second->call(
                                   _ctx.comm(),
                                   irods::RESOURCE_OP_REBALANCE,
                                   _ctx.fco() );
            if ( !ret.ok() ) {
                irods::log( PASS( ret ) );
                result = ret;
            }
        }
        
        if( !result.ok() ) {
            return PASS( result );
        }

        return update_resource_object_count( 
                   _ctx.comm(),
                   _ctx.prop_map() );

    } // pass_thru_file_rebalancec
Пример #2
0
irods::error round_robin_get_resc_for_call(
    irods::resource_plugin_context& _ctx,
    irods::resource_ptr&            _resc ) {
    // =-=-=-=-=-=-=-
    // check incoming parameters
    irods::error err = round_robin_check_params< DEST_TYPE >( _ctx );
    if ( !err.ok() ) {
        return PASSMSG( "round_robin_get_resc_for_call - bad resource context", err );
    }

    // =-=-=-=-=-=-=-
    // get the object's name
    std::string name;
    err = _ctx.prop_map().get< std::string >( irods::RESOURCE_NAME, name );
    if ( !err.ok() ) {
        return PASSMSG( "round_robin_get_resc_for_call - failed to get property 'name'.", err );
    }

    // =-=-=-=-=-=-=-
    // get the object's hier string
    boost::shared_ptr< DEST_TYPE > obj = boost::dynamic_pointer_cast< DEST_TYPE >( _ctx.fco() );
    std::string hier = obj->resc_hier( );

    // =-=-=-=-=-=-=-
    // get the next child pointer given our name and the hier string
    err = get_next_child_in_hier( name, hier, _ctx.child_map(), _resc );
    if ( !err.ok() ) {
        return PASSMSG( "round_robin_get_resc_for_call - get_next_child_in_hier failed.", err );
    }

    return SUCCESS();

} // round_robin_get_resc_for_call
Пример #3
0
    // =-=-=-=-=-=-=-
    // unixRedirectPlugin - used to allow the resource to determine which host
    //                      should provide the requested operation
    irods::error pass_thru_redirect_plugin(
        irods::resource_plugin_context& _ctx,
        const std::string*                  _opr,
        const std::string*                  _curr_host,
        irods::hierarchy_parser*           _out_parser,
        float*                              _out_vote ) {
        // =-=-=-=-=-=-=-
        // check incoming parameters
        irods::error result = SUCCESS();
        irods::error ret = pass_thru_check_params( _ctx );
        if ( !ret.ok() ) {
            result = PASSMSG( "pass_thru_redirect_plugin - invalid resource context.", ret );
        }
        if ( !_opr ) {
            return ERROR( SYS_INVALID_INPUT_PARAM, "pass_thru_redirect_plugin - null operation" );
        }
        if ( !_curr_host ) {
            return ERROR( SYS_INVALID_INPUT_PARAM, "pass_thru_redirect_plugin - null operation" );
        }
        if ( !_out_parser ) {
            return ERROR( SYS_INVALID_INPUT_PARAM, "pass_thru_redirect_plugin - null outgoing hier parser" );
        }
        if ( !_out_vote ) {
            return ERROR( SYS_INVALID_INPUT_PARAM, "pass_thru_redirect_plugin - null outgoing vote" );
        }

        // =-=-=-=-=-=-=-
        // get the name of this resource
        std::string resc_name;
        ret = _ctx.prop_map().get< std::string >( irods::RESOURCE_NAME, resc_name );
        if ( !ret.ok() ) {
            std::stringstream msg;
            msg << "pass_thru_redirect_plugin - failed in get property for name";
            return ERROR( -1, msg.str() );
        }

        // =-=-=-=-=-=-=-
        // add ourselves to the hierarchy parser by default
        _out_parser->add_child( resc_name );

        irods::resource_ptr resc;
        ret = pass_thru_get_first_chid_resc( _ctx.child_map(), resc );
        if ( !ret.ok() ) {
            return PASSMSG( "pass_thru_redirect_plugin - failed getting the first child resource pointer.", ret );
        }

        return resc->call < const std::string*,
               const std::string*,
               irods::hierarchy_parser*,
               float* > (
                   _ctx.comm(),
                   irods::RESOURCE_OP_RESOLVE_RESC_HIER,
                   _ctx.fco(),
                   _opr,
                   _curr_host,
                   _out_parser,
                   _out_vote );

    } // pass_thru_redirect_plugin
Пример #4
0
    /// =-=-=-=-=-=-=-
    /// @brief interface to notify of a file modification
    irods::error round_robin_file_modified(
        irods::resource_plugin_context& _ctx ) {
        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = round_robin_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( !err.ok() ) {
            return PASS( err );
        }

        // =-=-=-=-=-=-=-
        // call modified on the child
        err = resc->call( _ctx.comm(), irods::RESOURCE_OP_MODIFIED, _ctx.fco() );
        if ( !err.ok() ) {
            return PASS( err );
        }

        // =-=-=-=-=-=-=-
        // if file modified is successful then we will update the next
        // child in the round robin within the database
        std::string name;
        _ctx.prop_map().get< std::string >( irods::RESOURCE_NAME, name );

        std::string next_child;
        _ctx.prop_map().get< std::string >( NEXT_CHILD_PROP, next_child );

        setRoundRobinContextInp_t inp;
        strncpy( inp.resc_name_, name.c_str(),       NAME_LEN );
        strncpy( inp.context_,   next_child.c_str(), MAX_NAME_LEN );
        int status = irods::server_api_call(
                         SET_RR_CTX_AN,
                         _ctx.comm(),
                         &inp,
                         NULL,
                         ( void** ) NULL,
                         NULL );

        if ( status < 0 ) {
            std::stringstream msg;
            msg << "failed to update round robin context for [";
            msg << name << "] with context [" << next_child << "]";
            return ERROR(
                       status,
                       msg.str() );

        }
        else {
            return SUCCESS();

        }

    } // round_robin_file_modified
Пример #5
0
    /// =-=-=-=-=-=-=-
    /// @brief interface for POSIX truncate
    irods::error round_robin_file_truncate(
        irods::resource_plugin_context& _ctx ) {
        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = round_robin_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( !err.ok() ) {
            return PASS( err );
        }

        // =-=-=-=-=-=-=-
        // call truncate on the child
        return resc->call( _ctx.comm(), irods::RESOURCE_OP_TRUNCATE, _ctx.fco() );

    } // round_robin_file_truncate
Пример #6
0
    // =-=-=-=-=-=-=-
    /// @brief interface for POSIX closedir
    irods::error random_file_closedir(
        irods::resource_plugin_context& _ctx ) {
        irods::error result = SUCCESS();

        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = random_get_resc_for_call< irods::collection_object >( _ctx, resc );
        if ( ( result = ASSERT_PASS( err, "Failed to select random resource." ) ).ok() ) {

            // =-=-=-=-=-=-=-
            // call closedir on the child
            err = resc->call( _ctx.comm(), irods::RESOURCE_OP_CLOSEDIR, _ctx.fco() );
            result = ASSERT_PASS( err, "Failed calling child operation." );
        }

        return result;
    } // random_file_closedir
Пример #7
0
    /// =-=-=-=-=-=-=-
    /// @brief interface for POSIX create
    irods::error random_file_create(
        irods::resource_plugin_context& _ctx ) {
        irods::error result = SUCCESS();

        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = random_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( ( result = ASSERT_PASS( err, "Invalid resource context." ) ).ok() ) {

            // =-=-=-=-=-=-=-
            // call create on the child
            err = resc->call( _ctx.comm(), irods::RESOURCE_OP_CREATE, _ctx.fco() );
            result = ASSERT_PASS( err, "Failed calling create on child resource." );
        }

        return result;
    } // random_file_create
Пример #8
0
    /// =-=-=-=-=-=-=-
    /// @brief interface to notify of a file unregistration
    irods::error load_balanced_file_unregistered(
        irods::resource_plugin_context& _ctx ) {
        irods::error result = SUCCESS();

        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( ( result = ASSERT_PASS( err, "Failed selecting load_balanced resource." ) ).ok() ) {

            // =-=-=-=-=-=-=-
            // call rename on the child
            err = resc->call( _ctx.comm(), irods::RESOURCE_OP_UNREGISTERED, _ctx.fco() );
            result = ASSERT_PASS( err, "Failed calling child operation." );
        }

        return result;
    } // load_balanced_file_unregistered
Пример #9
0
    /// =-=-=-=-=-=-=-
    /// @brief interface for POSIX Close
    irods::error load_balanced_file_close(
        irods::resource_plugin_context& _ctx ) {
        irods::error result = SUCCESS();

        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( ( result = ASSERT_PASS( err, "Failed to select load_balanced resource." ) ).ok() ) {

            // =-=-=-=-=-=-=-
            // call close on the child
            err = resc->call( _ctx.comm(), irods::RESOURCE_OP_CLOSE, _ctx.fco() );
            result = ASSERT_PASS( err, "Failed calling operation in child." );
        }

        return result;
    } // load_balanced_file_close
Пример #10
0
    /// =-=-=-=-=-=-=-
    /// @brief interface to notify of a file modification
    irods::error random_file_modified(
        irods::resource_plugin_context& _ctx ) {
        irods::error result = SUCCESS();

        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = random_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( ( result = ASSERT_PASS( err, "Failed selecting random resource." ) ).ok() ) {

            // =-=-=-=-=-=-=-
            // call rename on the child
            err = resc->call( _ctx.comm(), irods::RESOURCE_OP_MODIFIED, _ctx.fco() );
            result = ASSERT_PASS( err, "Failed calling child operation." );
        }

        return result;
    } // random_file_modified
Пример #11
0
    /// =-=-=-=-=-=-=-
    /// @brief interface to notify of a file unregistration
    irods::error round_robin_file_unregistered(
        irods::resource_plugin_context& _ctx ) {
        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = round_robin_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( !err.ok() ) {
            std::stringstream msg;
            msg <<  __FUNCTION__;
            msg << " - failed.";
            return PASSMSG( msg.str(), err );
        }

        // =-=-=-=-=-=-=-
        // call unregistered on the child
        return resc->call( _ctx.comm(), irods::RESOURCE_OP_UNREGISTERED, _ctx.fco() );

    } // round_robin_file_unregistered
Пример #12
0
    // =-=-=-=-=-=-=-
    /// @brief interface for POSIX closedir
    irods::error round_robin_file_closedir(
        irods::resource_plugin_context& _ctx ) {
        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = round_robin_get_resc_for_call< irods::collection_object >( _ctx, resc );
        if ( !err.ok() ) {
            std::stringstream msg;
            msg <<  __FUNCTION__;
            msg << " - failed.";
            return PASSMSG( msg.str(), err );
        }

        // =-=-=-=-=-=-=-
        // call closedir on the child
        return resc->call( _ctx.comm(), irods::RESOURCE_OP_CLOSEDIR, _ctx.fco() );

    } // round_robin_file_closedir
Пример #13
0
    /// =-=-=-=-=-=-=-
    /// @brief interface for POSIX Unlink
    irods::error random_file_unlink(
        irods::resource_plugin_context& _ctx ) {
        irods::error result = SUCCESS();

        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = random_get_resc_for_call< irods::data_object >( _ctx, resc );
        if ( ( result = ASSERT_PASS( err, "Failed to select random resource." ) ).ok() ) {

            // =-=-=-=-=-=-=-
            // call unlink on the child
            err = resc->call( _ctx.comm(), irods::RESOURCE_OP_UNLINK, _ctx.fco() );
            result = ASSERT_PASS( err, "Failed during call to child operation." );
        }

        return result;
    } // random_file_unlink
Пример #14
0
    // =-=-=-=-=-=-=-
    // interface for POSIX Open
    irods::error random_file_open(
        irods::resource_plugin_context& _ctx ) {
        irods::error result = SUCCESS();

        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = random_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( ( result = ASSERT_PASS( err, "Failed in file open." ) ).ok() ) {

            // =-=-=-=-=-=-=-
            // call open operation on the child
            err = resc->call( _ctx.comm(), irods::RESOURCE_OP_OPEN, _ctx.fco() );
            result = ASSERT_PASS( err, "Failed calling open on the child." );
        }

        return result;
    } // random_file_open
Пример #15
0
    /// =-=-=-=-=-=-=-
    /// @brief interface for POSIX rename
    irods::error round_robin_file_rename(
        irods::resource_plugin_context& _ctx,
        const char*                         _new_file_name ) {
        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = round_robin_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( !err.ok() ) {
            std::stringstream msg;
            msg <<  __FUNCTION__;
            msg << " - failed.";
            return PASSMSG( msg.str(), err );
        }

        // =-=-=-=-=-=-=-
        // call rename on the child
        return resc->call< const char* >( _ctx.comm(), irods::RESOURCE_OP_RENAME, _ctx.fco(), _new_file_name );

    } // round_robin_file_rename
Пример #16
0
    /// =-=-=-=-=-=-=-
    /// @brief interface for POSIX Stat
    irods::error round_robin_file_stat(
        irods::resource_plugin_context& _ctx,
        struct stat*                     _statbuf ) {
        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = round_robin_get_resc_for_call< irods::data_object >( _ctx, resc );
        if ( !err.ok() ) {
            std::stringstream msg;
            msg <<  __FUNCTION__;
            msg << " - failed.";
            return PASSMSG( msg.str(), err );
        }

        // =-=-=-=-=-=-=-
        // call stat on the child
        return resc->call< struct stat* >( _ctx.comm(), irods::RESOURCE_OP_STAT, _ctx.fco(), _statbuf );

    } // round_robin_file_stat
Пример #17
0
    /// =-=-=-=-=-=-=-
    /// @brief interface to notify a resource of an operation
    irods::error random_file_notify(
        irods::resource_plugin_context& _ctx,
        const std::string*               _opr ) {
        irods::error result = SUCCESS();

        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = random_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( ( result = ASSERT_PASS( err, "Failed selecting random resource." ) ).ok() ) {

            // =-=-=-=-=-=-=-
            // call rename on the child
            err = resc->call( _ctx.comm(), irods::RESOURCE_OP_NOTIFY, _ctx.fco(), _opr );
            result = ASSERT_PASS_MSG( err, "Failed calling child operation." );
        }

        return result;
    } // random_file_notify
Пример #18
0
    /// =-=-=-=-=-=-=-
    /// @brief interface for POSIX rename
    irods::error random_file_rename(
        irods::resource_plugin_context& _ctx,
        const char*                         _new_file_name ) {
        irods::error result = SUCCESS();

        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = random_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( ( result = ASSERT_PASS( err, "Failed to select random resource." ) ).ok() ) {

            // =-=-=-=-=-=-=-
            // call rename on the child
            err = resc->call< const char* >( _ctx.comm(), irods::RESOURCE_OP_RENAME, _ctx.fco(), _new_file_name );
            result = ASSERT_PASS( err, "Failed calling child operation." );
        }

        return result;
    } // random_file_rename
Пример #19
0
    /// =-=-=-=-=-=-=-
    /// @brief interface for POSIX Stat
    irods::error random_file_stat(
        irods::resource_plugin_context& _ctx,
        struct stat*                     _statbuf ) {
        irods::error result = SUCCESS();

        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = random_get_resc_for_call< irods::data_object >( _ctx, resc );
        if ( ( result = ASSERT_PASS( err, "Failed selecting random child resource." ) ).ok() ) {

            // =-=-=-=-=-=-=-
            // call stat on the child
            err = resc->call< struct stat* >( _ctx.comm(), irods::RESOURCE_OP_STAT, _ctx.fco(), _statbuf );
            result = ASSERT_PASS( err, "Failed in call to child operation." );
        }

        return result;
    } // random_file_stat
Пример #20
0
    /// =-=-=-=-=-=-=-
    /// @brief interface for POSIX Write
    irods::error round_robin_file_write(
        irods::resource_plugin_context& _ctx,
        void*                               _buf,
        int                                 _len ) {
        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = round_robin_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( !err.ok() ) {
            std::stringstream msg;
            msg <<  __FUNCTION__;
            msg << " - failed.";
            return PASSMSG( msg.str(), err );
        }

        // =-=-=-=-=-=-=-
        // call write on the child
        return resc->call< void*, int >( _ctx.comm(), irods::RESOURCE_OP_WRITE, _ctx.fco(), _buf, _len );

    } // round_robin_file_write
Пример #21
0
    /// =-=-=-=-=-=-=-
    /// @brief interface for POSIX lseek
    irods::error round_robin_file_lseek(
        irods::resource_plugin_context& _ctx,
        long long                        _offset,
        int                              _whence ) {
        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = round_robin_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( !err.ok() ) {
            std::stringstream msg;
            msg <<  __FUNCTION__;
            msg << " - failed.";
            return PASSMSG( msg.str(), err );
        }

        // =-=-=-=-=-=-=-
        // call lseek on the child
        return resc->call< long long, int >( _ctx.comm(), irods::RESOURCE_OP_LSEEK, _ctx.fco(), _offset, _whence );

    } // round_robin_file_lseek
Пример #22
0
    /// =-=-=-=-=-=-=-
    /// @brief interface for POSIX Write
    irods::error random_file_write(
        irods::resource_plugin_context& _ctx,
        void*                               _buf,
        int                                 _len ) {
        irods::error result = SUCCESS();

        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = random_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( ( result = ASSERT_PASS( err, "Failed choosing child resource." ) ).ok() ) {

            // =-=-=-=-=-=-=-
            // call write on the child
            err = resc->call< void*, int >( _ctx.comm(), irods::RESOURCE_OP_WRITE, _ctx.fco(), _buf, _len );
            result = ASSERT_PASS( err, "Failed calling operation on child resource." );
        }

        return result;
    } // random_file_write
Пример #23
0
    /// =-=-=-=-=-=-=-
    /// @brief interface for POSIX Read
    irods::error load_balanced_file_read(
        irods::resource_plugin_context& _ctx,
        void*                               _buf,
        int                                 _len ) {
        irods::error result = SUCCESS();

        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( ( result = ASSERT_PASS( err, "Failed finding resource." ) ).ok() ) {

            // =-=-=-=-=-=-=-
            // call read on the child
            err = resc->call< void*, int >( _ctx.comm(), irods::RESOURCE_OP_READ, _ctx.fco(), _buf, _len );
            result = ASSERT_PASS( err, "Failed calling operation on child resource." );
        }

        return result;

    } // load_balanced_file_read
Пример #24
0
    // =-=-=-=-=-=-=-
    // pass_thru_file_rebalance - code which would notify the subtree of a change
    irods::error pass_thru_file_notify(
        irods::resource_plugin_context& _ctx,
        const std::string*               _opr ) {
        // =-=-=-=-=-=-=-
        // forward request for notify to children
        irods::error result = SUCCESS();
        irods::resource_child_map::iterator itr = _ctx.child_map().begin();
        for ( ; itr != _ctx.child_map().end(); ++itr ) {
            irods::error ret = itr->second.second->call(
                                   _ctx.comm(),
                                   irods::RESOURCE_OP_NOTIFY,
                                   _ctx.fco(),
                                   _opr );
            if ( !ret.ok() ) {
                irods::log( PASS( ret ) );
                result = ret;
            }
        }

        return result;

    } // pass_thru_file_notify
Пример #25
0
    // =-=-=-=-=-=-=-
    // interface to determine free space on a device given a path
    irods::error pass_thru_file_getfsfreespace_plugin(
        irods::resource_plugin_context& _ctx ) {
        irods::error result = SUCCESS();
        irods::error ret;

        ret = pass_thru_check_params( _ctx );
        if ( !ret.ok() ) {
            result = PASSMSG( "pass_thru_file_getfsfreespace_plugin - bad params.", ret );
        }
        else {
            irods::resource_ptr resc;
            ret = pass_thru_get_first_chid_resc( _ctx.child_map(), resc );
            if ( !ret.ok() ) {
                result = PASSMSG( "pass_thru_file_getfsfreespace_plugin - failed getting the first child resource pointer.", ret );
            }
            else {
                ret = resc->call( _ctx.comm(), irods::RESOURCE_OP_FREESPACE, _ctx.fco() );
                result = PASSMSG( "pass_thru_file_getfsfreespace_plugin - failed calling child freespace.", ret );
            }
        }
        return result;
    } // pass_thru_file_getfsfreespace_plugin
Пример #26
0
    // =-=-=-=-=-=-=-
    // interface for POSIX Open
    irods::error round_robin_file_notify(
        irods::resource_plugin_context& _ctx,
        const std::string*               _opr ) {
        // =-=-=-=-=-=-=-
        // get the child resc to call
        irods::resource_ptr resc;
        irods::error err = round_robin_get_resc_for_call< irods::file_object >( _ctx, resc );
        if ( !err.ok() ) {
            std::stringstream msg;
            msg << "failed.";
            return PASSMSG( msg.str(), err );
        }

        // =-=-=-=-=-=-=-
        // call open operation on the child
        return resc->call< const std::string* >(
                   _ctx.comm(),
                   irods::RESOURCE_OP_NOTIFY,
                   _ctx.fco(),
                   _opr );

    } // round_robin_file_open
Пример #27
0
    /// =-=-=-=-=-=-=-
    /// @brief interface to notify of a file unregistration
    irods::error pass_thru_file_unregistered(
        irods::resource_plugin_context& _ctx ) {
        irods::error result = SUCCESS();
        irods::error ret;

        ret = pass_thru_check_params( _ctx );
        if ( !ret.ok() ) {
            result = PASSMSG( "bad params.", ret );
        }
        else {
            irods::resource_ptr resc;
            ret = pass_thru_get_first_chid_resc( _ctx.child_map(), resc );
            if ( !ret.ok() ) {
                result = PASSMSG( "failed getting the first child resource pointer.", ret );
            }
            else {
                ret = resc->call( _ctx.comm(), irods::RESOURCE_OP_UNREGISTERED, _ctx.fco() );

                result = PASSMSG( "failed calling child unregistered.", ret );
            }
        }
        return result;
    } // pass_thru_file_unregistered
Пример #28
0
    // =-=-=-=-=-=-=-
    // interface for POSIX Write
    irods::error pass_thru_file_write_plugin(
        irods::resource_plugin_context& _ctx,
        void*                               _buf,
        int                                 _len ) {
        irods::error result = SUCCESS();
        irods::error ret;

        ret = pass_thru_check_params( _ctx );
        if ( !ret.ok() ) {
            result = PASSMSG( "bad params.", ret );
        }
        else {
            irods::resource_ptr resc;
            ret = pass_thru_get_first_chid_resc( _ctx.child_map(), resc );
            if ( !ret.ok() ) {
                result = PASSMSG( "failed getting the first child resource pointer.", ret );
            }
            else {
                ret = resc->call<void*, int>( _ctx.comm(), irods::RESOURCE_OP_WRITE, _ctx.fco(), _buf, _len );
                result = PASSMSG( "pass_thru_file_write_plugin - failed calling child write.", ret );
            }
        }
        return result;
    } // pass_thru_file_write_plugin
Пример #29
0
    // =-=-=-=-=-=-=-
    // passthruSyncToArch - This routine is for testing the TEST_STAGE_FILE_TYPE.
    // Just copy the file from cacheFilename to filename. optionalInfo info
    // is not used.
    irods::error pass_thru_sync_to_arch_plugin(
        irods::resource_plugin_context& _ctx,
        const char*                         _cache_file_name ) {
        irods::error result = SUCCESS();
        irods::error ret;

        ret = pass_thru_check_params( _ctx );
        if ( !ret.ok() ) {
            result = PASSMSG( "pass_thru_sync_to_arch_plugin - bad params.", ret );
        }
        else {
            irods::resource_ptr resc;
            ret = pass_thru_get_first_chid_resc( _ctx.child_map(), resc );
            if ( !ret.ok() ) {
                result = PASSMSG( "pass_thru_sync_to_arch_plugin - failed getting the first child resource pointer.", ret );
            }
            else {
                ret = resc->call<const char*>( _ctx.comm(), irods::RESOURCE_OP_SYNCTOARCH, _ctx.fco(), _cache_file_name );

                result = PASSMSG( "pass_thru_sync_to_arch_plugin - failed calling child synctoarch.", ret );
            }
        }
        return result;
    } // pass_thru_sync_to_arch_plugin
Пример #30
0
    // =-=-=-=-=-=-=-
    // interface for POSIX readdir
    irods::error pass_thru_file_readdir_plugin(
        irods::resource_plugin_context& _ctx,
        struct rodsDirent**                 _dirent_ptr ) {
        irods::error result = SUCCESS();
        irods::error ret;

        ret = pass_thru_check_params( _ctx );
        if ( !ret.ok() ) {
            result = PASSMSG( "pass_thru_file_readdir_plugin - bad params.", ret );
        }
        else {
            irods::resource_ptr resc;
            ret = pass_thru_get_first_chid_resc( _ctx.child_map(), resc );
            if ( !ret.ok() ) {
                result = PASSMSG( "pass_thru_file_readdir_plugin - failed getting the first child resource pointer.", ret );
            }
            else {
                ret = resc->call<struct rodsDirent**>( _ctx.comm(), irods::RESOURCE_OP_READDIR, _ctx.fco(), _dirent_ptr );
                result = PASSMSG( "pass_thru_file_readdir_plugin - failed calling child readdir.", ret );
            }
        }
        return result;
    } // pass_thru_file_readdir_plugin