当前位置: 首页>>代码示例>>C++>>正文


C++ resource_plugin_context::child_map方法代码示例

本文整理汇总了C++中irods::resource_plugin_context::child_map方法的典型用法代码示例。如果您正苦于以下问题:C++ resource_plugin_context::child_map方法的具体用法?C++ resource_plugin_context::child_map怎么用?C++ resource_plugin_context::child_map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在irods::resource_plugin_context的用法示例。


在下文中一共展示了resource_plugin_context::child_map方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pass_thru_file_rebalance

    // =-=-=-=-=-=-=-
    // 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
开发者ID:PlantandFoodResearch,项目名称:irods,代码行数:28,代码来源:libpassthru.cpp

示例2: random_get_resc_for_call

irods::error random_get_resc_for_call(
    irods::resource_plugin_context& _ctx,
    irods::resource_ptr&            _resc ) {
    irods::error result = SUCCESS();

    // =-=-=-=-=-=-=-
    // check incoming parameters
    irods::error err = random_check_params< DEST_TYPE >( _ctx );
    if ( ( result = ASSERT_PASS( err, "Bad resource context." ) ).ok() ) {

        // =-=-=-=-=-=-=-
        // get the object's name
        std::string name;
        err = _ctx.prop_map().get< std::string >( irods::RESOURCE_NAME, name );
        if ( ( result = ASSERT_PASS( err, "Failed to get property." ) ).ok() ) {

            // =-=-=-=-=-=-=-
            // get the object's hier string
            boost::shared_ptr< DEST_TYPE > dst_obj = boost::dynamic_pointer_cast< DEST_TYPE >( _ctx.fco() );
            std::string hier = dst_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 );
            result = ASSERT_PASS( err, "Get next child failed." );
        }
    }

    return result;

} // random_get_resc_for_call
开发者ID:0x414A,项目名称:irods,代码行数:31,代码来源:librandom.cpp

示例3: round_robin_get_resc_for_call

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
开发者ID:PlantandFoodResearch,项目名称:irods,代码行数:33,代码来源:libroundrobin.cpp

示例4: pass_thru_redirect_plugin

    // =-=-=-=-=-=-=-
    // 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
开发者ID:PlantandFoodResearch,项目名称:irods,代码行数:62,代码来源:libpassthru.cpp

示例5: pass_thru_file_notify

    // =-=-=-=-=-=-=-
    // 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
开发者ID:PlantandFoodResearch,项目名称:irods,代码行数:24,代码来源:libpassthru.cpp

示例6: pass_thru_file_getfsfreespace_plugin

    // =-=-=-=-=-=-=-
    // 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
开发者ID:PlantandFoodResearch,项目名称:irods,代码行数:24,代码来源:libpassthru.cpp

示例7: pass_thru_file_unregistered

    /// =-=-=-=-=-=-=-
    /// @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
开发者ID:PlantandFoodResearch,项目名称:irods,代码行数:25,代码来源:libpassthru.cpp

示例8: pass_thru_stage_to_cache_plugin

    // =-=-=-=-=-=-=-
    // passthruStageToCache - This routine is for testing the TEST_STAGE_FILE_TYPE.
    // Just copy the file from filename to cacheFilename. optionalInfo info
    // is not used.
    irods::error pass_thru_stage_to_cache_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_stage_to_cache_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_stage_to_cache_plugin - failed getting the first child resource pointer.", ret );
            }
            else {
                ret = resc->call<const char*>( _ctx.comm(), irods::RESOURCE_OP_STAGETOCACHE, _ctx.fco(), _cache_file_name );
                result = PASSMSG( "pass_thru_stage_to_cache_plugin - failed calling child stagetocache.", ret );
            }
        }
        return result;
    } // pass_thru_stage_to_cache_plugin
开发者ID:PlantandFoodResearch,项目名称:irods,代码行数:27,代码来源:libpassthru.cpp

示例9: pass_thru_file_readdir_plugin

    // =-=-=-=-=-=-=-
    // 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
开发者ID:PlantandFoodResearch,项目名称:irods,代码行数:25,代码来源:libpassthru.cpp

示例10: passthru_file_stat_plugin

    // =-=-=-=-=-=-=-
    // interface for POSIX Stat
    irods::error passthru_file_stat_plugin(
        irods::resource_plugin_context& _ctx,
        struct stat*                        _statbuf ) {
        irods::error result = SUCCESS();
        irods::error ret;

        ret = passthru_check_params( _ctx );
        if ( !ret.ok() ) {
            result = PASSMSG( "passthru_file_stat_plugin - bad params.", ret );
        }
        else {
            irods::resource_ptr resc;
            ret = passthru_get_first_child_resc( _ctx.child_map(), resc );
            if ( !ret.ok() ) {
                result = PASSMSG( "passthru_file_stat_plugin - failed getting the first child resource pointer.", ret );
            }
            else {
                ret = resc->call<struct stat*>( _ctx.comm(), irods::RESOURCE_OP_STAT, _ctx.fco(), _statbuf );
                result = PASSMSG( "passthru_file_stat_plugin - failed calling child stat.", ret );
            }
        }
        return result;
    } // passthru_file_stat_plugin
开发者ID:0x414A,项目名称:irods,代码行数:25,代码来源:libpassthru.cpp

示例11: pass_thru_file_lseek_plugin

    // =-=-=-=-=-=-=-
    // interface for POSIX lseek
    irods::error pass_thru_file_lseek_plugin(
        irods::resource_plugin_context& _ctx,
        long long                        _offset,
        int                              _whence ) {
        irods::error result = SUCCESS();
        irods::error ret;

        ret = pass_thru_check_params( _ctx );
        if ( !ret.ok() ) {
            result = PASSMSG( "pass_thru_file_lseek_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_lseek_plugin - failed getting the first child resource pointer.", ret );
            }
            else {
                ret = resc->call<long long, int>( _ctx.comm(), irods::RESOURCE_OP_LSEEK, _ctx.fco(), _offset, _whence );
                result = PASSMSG( "pass_thru_file_lseek_plugin - failed calling child lseek.", ret );
            }
        }
        return result;
    } // pass_thru_file_lseek_plugin
开发者ID:PlantandFoodResearch,项目名称:irods,代码行数:26,代码来源:libpassthru.cpp

示例12: pass_thru_file_write_plugin

    // =-=-=-=-=-=-=-
    // 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
开发者ID:PlantandFoodResearch,项目名称:irods,代码行数:26,代码来源:libpassthru.cpp

示例13: random_redirect

    /// =-=-=-=-=-=-=-
    /// @brief used to allow the resource to determine which host
    ///        should provide the requested operation
    irods::error random_redirect(
        irods::resource_plugin_context& _ctx,
        const std::string*               _opr,
        const std::string*               _curr_host,
        irods::hierarchy_parser*        _out_parser,
        float*                           _out_vote ) {
        irods::error result = SUCCESS();

        // =-=-=-=-=-=-=-
        // check incoming parameters
        irods::error err = random_check_params< irods::file_object >( _ctx );
        if ( ( result = ASSERT_PASS( err, "Invalid resource context." ) ).ok() ) {
            if ( ( result = ASSERT_ERROR( _opr && _curr_host && _out_parser && _out_vote, SYS_INVALID_INPUT_PARAM,
                                          "Invalid parameters." ) ).ok() ) {

                // =-=-=-=-=-=-=-
                // get the object's hier string
                irods::file_object_ptr file_obj = boost::dynamic_pointer_cast< irods::file_object >( _ctx.fco() );
                std::string hier = file_obj->resc_hier( );

                // =-=-=-=-=-=-=-
                // get the object's hier string
                std::string name;
                err = _ctx.prop_map().get< std::string >( irods::RESOURCE_NAME, name );
                if ( ( result = ASSERT_PASS( err, "Failed to get property: \"%s\".", irods::RESOURCE_NAME.c_str() ) ).ok() ) {

                    // =-=-=-=-=-=-=-
                    // add ourselves into the hierarchy before calling child resources
                    _out_parser->add_child( name );

                    // =-=-=-=-=-=-=-
                    // test the operation to determine which choices to make
                    if ( irods::OPEN_OPERATION   == ( *_opr )  ||
                            irods::WRITE_OPERATION  == ( *_opr ) ||
                            irods::UNLINK_OPERATION == ( *_opr )) {

                        // =-=-=-=-=-=-=-
                        // get the next child pointer in the hierarchy, given our name and the hier string
                        irods::resource_ptr resc;
                        err = get_next_child_for_open_or_write( name, file_obj, _ctx.child_map(), resc );
                        if ( err.ok() ) {
                            // =-=-=-=-=-=-=-
                            // forward the redirect call to the child for assertion of the whole operation,
                            // there may be more than a leaf beneath us
                            err = 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 );
                            result = ASSERT_PASS( err, "Failed calling child operation." );
                        }
                        else if ( err.code() == REPLICA_NOT_IN_RESC ) {
                            *_out_vote = 0;
                        }
                        else {
                            result = err;
                        }
                    }
                    else if ( irods::CREATE_OPERATION == ( *_opr ) ) {

                        // =-=-=-=-=-=-=-
                        // get the next_child resource for create
                        irods::resource_ptr resc;
                        err = get_next_valid_child_resource( _ctx, _opr, _curr_host, _out_parser, _out_vote );
                        result = ASSERT_PASS( err, "Failed getting next valid child." );
                    }
                    else {

                        // =-=-=-=-=-=-=-
                        // must have been passed a bad operation
                        result = ASSERT_ERROR( false, INVALID_OPERATION, "Operation not supported: \"%s\".",
                                               _opr->c_str() );
                    }
                }
            }
        }

        return result;
    } // random_redirect
开发者ID:0x414A,项目名称:irods,代码行数:81,代码来源:librandom.cpp

示例14: univ_mss_file_sync_to_arch

    /// =-=-=-=-=-=-=-
    /// @brief 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 univ_mss_file_sync_to_arch(
        irods::resource_plugin_context& _ctx,
        const char*                         _cache_file_name ) {
        // =-=-=-=-=-=-=-
        // check context
        irods::error err = univ_mss_check_param< irods::file_object >( _ctx );
        if ( !err.ok() ) {
            std::stringstream msg;
            msg << __FUNCTION__;
            msg << " - invalid context";
            return PASSMSG( msg.str(), err );

        }

        // =-=-=-=-=-=-=-
        // snag a ref to the fco
        irods::file_object_ptr fco = boost::dynamic_pointer_cast< irods::file_object >( _ctx.fco() );
        std::string filename = fco->physical_path();

        // =-=-=-=-=-=-=-
        // first create the directory name
        char  dirname[MAX_NAME_LEN] = "";
        const char* lastpart = strrchr( filename.c_str(), '/' );
        int   lenDir   = strlen( filename.c_str() ) - strlen( lastpart );
        strncpy( dirname, filename.c_str(), lenDir );

        // =-=-=-=-=-=-=-
        // create a context to call the mkdir operation
        irods::collection_object_ptr coll_obj(
            new irods::collection_object(
                dirname,
                fco->resc_hier(),
                fco->mode(), 0 ) );
        irods::resource_plugin_context context(
            _ctx.prop_map(),
            coll_obj, "",
            _ctx.comm(),
            _ctx.child_map() );

        // =-=-=-=-=-=-=-
        // create the directory on the MSS
        int status = 0;
        err = univ_mss_file_mkdir( context );

        execCmdOut_t* execCmdOut = NULL;
        char  cmdArgv[HUGE_NAME_LEN] = "";

        execCmd_t execCmdInp;
        bzero( &execCmdInp, sizeof( execCmdInp ) );

        // =-=-=-=-=-=-=-
        // get the script property
        std::string script;
        err = _ctx.prop_map().get< std::string >( SCRIPT_PROP, script );
        if ( !err.ok() ) {
            return PASSMSG( __FUNCTION__, err );
        }

        rstrcpy( execCmdInp.cmd, script.c_str(), LONG_NAME_LEN );
        strcat( cmdArgv, "syncToArch" );
        strcat( cmdArgv, " " );
        strcat( cmdArgv, _cache_file_name );
        strcat( cmdArgv, " " );
        strcat( cmdArgv, filename.c_str() );
        strcat( cmdArgv, "" );

        rstrcpy( execCmdInp.cmdArgv, cmdArgv, HUGE_NAME_LEN );
        rstrcpy( execCmdInp.execAddr, "localhost", LONG_NAME_LEN );
        status = _rsExecCmd( _ctx.comm(), &execCmdInp, &execCmdOut );
        if ( status == 0 ) {
            err = univ_mss_file_chmod( _ctx );
            if ( !err.ok() ) {
                PASSMSG( "univ_mss_file_sync_to_arch - failed.", err );
            }
        }
        else {
            status = UNIV_MSS_SYNCTOARCH_ERR - errno;
            std::stringstream msg;
            msg << "univ_mss_file_sync_to_arch: copy of [";
            msg << _cache_file_name;
            msg << "] to [";
            msg << filename;
            msg << "] failed.";
            msg << "   stdout buff [";
            msg << execCmdOut->stdoutBuf.buf;
            msg << "]   stderr buff [";
            msg << execCmdOut->stderrBuf.buf;
            msg << "]  status [";
            msg << execCmdOut->status << "]";
            return ERROR( status, msg.str() );
        }

        return CODE( status );

    } // univ_mss_file_sync_to_arch
开发者ID:PlantandFoodResearch,项目名称:irods,代码行数:99,代码来源:libunivmss.cpp

示例15: round_robin_redirect

    /// =-=-=-=-=-=-=-
    /// @brief used to allow the resource to determine which host
    ///        should provide the requested operation
    irods::error round_robin_redirect(
        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 err = round_robin_check_params< irods::file_object >( _ctx );
        if ( !err.ok() ) {
            return PASSMSG( "round_robin_redirect - bad resource context", err );
        }
        if ( !_opr ) {
            return ERROR( SYS_INVALID_INPUT_PARAM, "round_robin_redirect - null operation" );
        }
        if ( !_curr_host ) {
            return ERROR( SYS_INVALID_INPUT_PARAM, "round_robin_redirect - null host" );
        }
        if ( !_out_parser ) {
            return ERROR( SYS_INVALID_INPUT_PARAM, "round_robin_redirect - null outgoing hier parser" );
        }
        if ( !_out_vote ) {
            return ERROR( SYS_INVALID_INPUT_PARAM, "round_robin_redirect - null outgoing vote" );
        }

        // =-=-=-=-=-=-=-
        // get the object's hier string
        irods::file_object_ptr file_obj = boost::dynamic_pointer_cast< irods::file_object >( _ctx.fco() );
        std::string hier = file_obj->resc_hier( );

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

        // =-=-=-=-=-=-=-
        // add ourselves into the hierarch before calling child resources
        _out_parser->add_child( name );

        // =-=-=-=-=-=-=-
        // test the operation to determine which choices to make
        if ( irods::OPEN_OPERATION  == ( *_opr )  ||
             irods::WRITE_OPERATION == ( *_opr ) ) {
            // =-=-=-=-=-=-=-
            // get the next child pointer in the hierarchy, given our name and the hier string
            irods::resource_ptr resc;
            err = get_next_child_for_open_or_write( 
                      name, 
                      file_obj, 
                      _ctx.child_map(), 
                      resc );
            if ( !err.ok() ) {
                (*_out_vote) = 0.0;
                return PASS( err );
            }

            // =-=-=-=-=-=-=-
            // forward the redirect call to the child for assertion of the whole operation,
            // there may be more than a leaf beneath us
            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 );

            std::string hier;
            _out_parser->str( hier );
            rodsLog( 
                LOG_DEBUG,
                "open :: resc hier [%s] vote [%f]",
                hier.c_str(),
                _out_vote );

        }
        else if ( irods::CREATE_OPERATION == ( *_opr ) ) {
            // =-=-=-=-=-=-=-
            // get the next available child resource
            irods::resource_ptr resc;
            irods::error err = get_next_valid_child_resource(
                                   _ctx.prop_map(),
                                   _ctx.child_map(),
                                   resc );
            if ( !err.ok() ) {
                return PASS( err );

            }

            // =-=-=-=-=-=-=-
//.........这里部分代码省略.........
开发者ID:PlantandFoodResearch,项目名称:irods,代码行数:101,代码来源:libroundrobin.cpp


注:本文中的irods::resource_plugin_context::child_map方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。