本文整理汇总了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;
}
示例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");
}
示例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));
}
示例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));
}