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


C++ WriteErrorDetail::setErrCode方法代码示例

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


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

示例1: toWriteError

    static WriteErrorDetail* toWriteError( const Status& status ) {

        WriteErrorDetail* error = new WriteErrorDetail;

        // TODO: Complex transform here?
        error->setErrCode( status.code() );
        error->setErrMessage( status.reason() );

        return error;
    }
开发者ID:AndrewCEmil,项目名称:mongo,代码行数:10,代码来源:batch_executor.cpp

示例2: checkIsMasterForCollection

 static bool checkIsMasterForCollection(const std::string& ns, WriteOpResult* result) {
     if (!isMasterNs(ns.c_str())) {
         WriteErrorDetail* errorDetail = new WriteErrorDetail;
         result->setError(errorDetail);
         errorDetail->setErrCode(ErrorCodes::NotMaster);
         errorDetail->setErrMessage("Not primary while writing to " + ns);
         return false;
     }
     return true;
 }
开发者ID:joegen,项目名称:sipx-externals,代码行数:10,代码来源:batch_executor.cpp

示例3: checkIsMasterForCollection

static bool checkIsMasterForCollection(const NamespaceString& ns, WriteErrorDetail** error) {
    if (!isMasterNs(ns.ns().c_str())) {
        WriteErrorDetail* errorDetail = *error = new WriteErrorDetail;
        errorDetail->setErrCode(ErrorCodes::NotMaster);
        errorDetail->setErrMessage(std::string(mongoutils::str::stream() <<
                                               "Not primary while writing to " << ns.ns()));
        return false;
    }
    return true;
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例4: checkIsMasterForDatabase

 static bool checkIsMasterForDatabase(const std::string& ns, WriteOpResult* result) {
     if (!repl::getGlobalReplicationCoordinator()->canAcceptWritesForDatabase(
             NamespaceString(ns).db())) {
         WriteErrorDetail* errorDetail = new WriteErrorDetail;
         result->setError(errorDetail);
         errorDetail->setErrCode(ErrorCodes::NotMaster);
         errorDetail->setErrMessage("Not primary while writing to " + ns);
         return false;
     }
     return true;
 }
开发者ID:AndrewCEmil,项目名称:mongo,代码行数:11,代码来源:batch_executor.cpp

示例5: lastErrorToBatchError

WriteErrorDetail* BatchSafeWriter::lastErrorToBatchError( const LastError& lastError ) {

    bool isFailedOp = lastError.msg != "";
    bool isStaleOp = lastError.writebackId.isSet();
    dassert( !( isFailedOp && isStaleOp ) );

    if ( isFailedOp ) {
        WriteErrorDetail* batchError = new WriteErrorDetail;
        if ( lastError.code != 0 ) batchError->setErrCode( lastError.code );
        else batchError->setErrCode( ErrorCodes::UnknownError );
        batchError->setErrMessage( lastError.msg );
        return batchError;
    }
    else if ( isStaleOp ) {
        WriteErrorDetail* batchError = new WriteErrorDetail;
        batchError->setErrCode( ErrorCodes::StaleShardVersion );
        batchError->setErrInfo( BSON( "downconvert" << true ) ); // For debugging
        batchError->setErrMessage( "shard version was stale" );
        return batchError;
    }

    return NULL;
}
开发者ID:,项目名称:,代码行数:23,代码来源:


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