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


C++ NamespaceString::isSystemDotIndexes方法代码示例

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


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

示例1: setShardVersion

void OperationShardVersion::setShardVersion(NamespaceString ns, ChunkVersion newVersion) {
    // This currently supports only setting the shard version for one namespace.
    invariant(!_hasVersion || _ns == ns);
    invariant(!ns.isSystemDotIndexes() || ChunkVersion::isIgnoredVersion(newVersion));

    _ns = std::move(ns);
    _shardVersion = std::move(newVersion);
    _hasVersion = true;
}
开发者ID:kangic,项目名称:mongo,代码行数:9,代码来源:operation_shard_version.cpp

示例2: checkAuthForWriteCommand

Status checkAuthForWriteCommand(AuthorizationSession* authzSession,
                                BatchedCommandRequest::BatchType cmdType,
                                const NamespaceString& cmdNSS,
                                const BSONObj& cmdObj) {
    vector<Privilege> privileges;
    ActionSet actionsOnCommandNSS;

    if (shouldBypassDocumentValidationForCommand(cmdObj)) {
        actionsOnCommandNSS.addAction(ActionType::bypassDocumentValidation);
    }

    if (cmdType == BatchedCommandRequest::BatchType_Insert) {
        if (!cmdNSS.isSystemDotIndexes()) {
            actionsOnCommandNSS.addAction(ActionType::insert);
        } else {
            // Special-case indexes until we have a command
            string nsToIndex, errMsg;
            if (!BatchedCommandRequest::getIndexedNS(cmdObj, &nsToIndex, &errMsg)) {
                return Status(ErrorCodes::FailedToParse, errMsg);
            }

            NamespaceString nssToIndex(nsToIndex);
            privileges.push_back(
                Privilege(ResourcePattern::forExactNamespace(nssToIndex), ActionType::createIndex));
        }
    } else if (cmdType == BatchedCommandRequest::BatchType_Update) {
        actionsOnCommandNSS.addAction(ActionType::update);

        // Upsert also requires insert privs
        if (BatchedCommandRequest::containsUpserts(cmdObj)) {
            actionsOnCommandNSS.addAction(ActionType::insert);
        }
    } else {
        fassert(17251, cmdType == BatchedCommandRequest::BatchType_Delete);
        actionsOnCommandNSS.addAction(ActionType::remove);
    }


    if (!actionsOnCommandNSS.empty()) {
        privileges.emplace_back(ResourcePattern::forExactNamespace(cmdNSS), actionsOnCommandNSS);
    }

    if (authzSession->isAuthorizedForPrivileges(privileges))
        return Status::OK();

    return Status(ErrorCodes::Unauthorized, "unauthorized");
}
开发者ID:AlexOreshkevich,项目名称:mongo,代码行数:47,代码来源:write_commands_common.cpp

示例3: initializeFromCommand

void OperationShardVersion::initializeFromCommand(NamespaceString ns, const BSONObj& cmdObj) {
    if (ns.isSystemDotIndexes()) {
        setShardVersion(std::move(ns), ChunkVersion::IGNORED());
        return;
    }

    BSONElement versionElt;
    Status status = bsonExtractTypedField(cmdObj, kShardVersionField, BSONType::Array, &versionElt);
    if (!status.isOK()) {
        return;
    }

    const BSONArray versionArr(versionElt.Obj());
    bool hasVersion = false;
    ChunkVersion newVersion = ChunkVersion::fromBSON(versionArr, &hasVersion);

    if (!hasVersion) {
        return;
    }

    setShardVersion(std::move(ns), std::move(newVersion));
}
开发者ID:kangic,项目名称:mongo,代码行数:22,代码来源:operation_shard_version.cpp

示例4: initializeShardVersion

void OperationShardingState::initializeShardVersion(NamespaceString nss,
        const BSONElement& shardVersionElt) {
    invariant(!hasShardVersion());

    if (nss.isSystemDotIndexes()) {
        setShardVersion(std::move(nss), ChunkVersion::IGNORED());
        return;
    }

    if (shardVersionElt.eoo() || shardVersionElt.type() != BSONType::Array) {
        return;
    }

    const BSONArray versionArr(shardVersionElt.Obj());
    bool hasVersion = false;
    ChunkVersion newVersion = ChunkVersion::fromBSON(versionArr, &hasVersion);

    if (!hasVersion) {
        return;
    }

    setShardVersion(std::move(nss), std::move(newVersion));
}
开发者ID:ralic,项目名称:mongo,代码行数:23,代码来源:operation_sharding_state.cpp


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