diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2014-11-17 11:50:42 -0500 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2014-12-04 17:47:12 -0500 |
commit | f46025d68785e44c783abafd19411fc76c231fd9 (patch) | |
tree | 514f3bcf5fc65ff60b69ab46a4718819ead793d3 /src/mongo/s/write_ops/batched_update_request.cpp | |
parent | 367810995073e01ee58159deb1bb5b878882632f (diff) | |
download | mongo-f46025d68785e44c783abafd19411fc76c231fd9.tar.gz |
SERVER-16423: Reduce NamespaceString temporaries
Diffstat (limited to 'src/mongo/s/write_ops/batched_update_request.cpp')
-rw-r--r-- | src/mongo/s/write_ops/batched_update_request.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/mongo/s/write_ops/batched_update_request.cpp b/src/mongo/s/write_ops/batched_update_request.cpp index e4e26422961..cc0f57bf73f 100644 --- a/src/mongo/s/write_ops/batched_update_request.cpp +++ b/src/mongo/s/write_ops/batched_update_request.cpp @@ -102,8 +102,10 @@ namespace mongo { if (!errMsg) errMsg = &dummy; FieldParser::FieldState fieldState; - fieldState = FieldParser::extract(source, collName, &_collName, errMsg); + std::string collNameTemp; + fieldState = FieldParser::extract(source, collName, &collNameTemp, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; + _collName = NamespaceString(collNameTemp); _isCollNameSet = fieldState == FieldParser::FIELD_SET; fieldState = FieldParser::extract(source, updates, &_updates, errMsg); @@ -133,7 +135,7 @@ namespace mongo { } void BatchedUpdateRequest::clear() { - _collName.clear(); + _collName = NamespaceString(); _isCollNameSet = false; unsetUpdates(); @@ -179,23 +181,29 @@ namespace mongo { } void BatchedUpdateRequest::setCollName(const StringData& collName) { - _collName = collName.toString(); + _collName = NamespaceString(collName); _isCollNameSet = true; } - void BatchedUpdateRequest::unsetCollName() { - _isCollNameSet = false; - } + const std::string& BatchedUpdateRequest::getCollName() const { + dassert(_isCollNameSet); + return _collName.ns(); + } - bool BatchedUpdateRequest::isCollNameSet() const { - return _isCollNameSet; + void BatchedUpdateRequest::setCollNameNS(const NamespaceString& collName) { + _collName = collName; + _isCollNameSet = true; } - const std::string& BatchedUpdateRequest::getCollName() const { + const NamespaceString& BatchedUpdateRequest::getCollNameNS() const { dassert(_isCollNameSet); return _collName; } + const NamespaceString& BatchedUpdateRequest::getTargetingNSS() const { + return getCollNameNS(); + } + void BatchedUpdateRequest::setUpdates(const std::vector<BatchedUpdateDocument*>& updates) { unsetUpdates(); for (std::vector<BatchedUpdateDocument*>::const_iterator it = updates.begin(); |