summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-08-27 09:53:35 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-08-27 09:53:35 +0000
commit0a5c13aa1ab2117cfb5d70e13313426eb7f1a695 (patch)
treecd6adb9ea10d1ffd0815268082f414562e9cf7e2 /storage
parentc7cb8032b3de3dba59a8462cbf4ab82fc7b93c97 (diff)
- If document type has been resolved, use if for test-and-set too.
- Inline small frequently called methods.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/persistence/testandsethelper.cpp7
-rw-r--r--storage/src/vespa/storage/persistence/testandsethelper.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/storage/src/vespa/storage/persistence/testandsethelper.cpp b/storage/src/vespa/storage/persistence/testandsethelper.cpp
index 57586249817..ea3ad3c6cb3 100644
--- a/storage/src/vespa/storage/persistence/testandsethelper.cpp
+++ b/storage/src/vespa/storage/persistence/testandsethelper.cpp
@@ -11,7 +11,8 @@ using namespace std::string_literals;
namespace storage {
-void TestAndSetHelper::getDocumentType(const document::DocumentTypeRepo & documentTypeRepo) {
+void TestAndSetHelper::resolveDocumentType(const document::DocumentTypeRepo & documentTypeRepo) {
+ if (_docTypePtr != nullptr) return;
if (!_docId.hasDocType()) {
throw TestAndSetException(api::ReturnCode(api::ReturnCode::ILLEGAL_PARAMETERS, "Document id has no doctype"));
}
@@ -46,11 +47,11 @@ TestAndSetHelper::TestAndSetHelper(PersistenceThread & thread, const api::TestAn
_component(thread._env._component),
_cmd(cmd),
_docId(cmd.getDocumentId()),
- _docTypePtr(nullptr),
+ _docTypePtr(_cmd.getDocumentType()),
_missingDocumentImpliesMatch(missingDocumentImpliesMatch)
{
auto docTypeRepo = _component.getTypeRepo()->documentTypeRepo;
- getDocumentType(*docTypeRepo);
+ resolveDocumentType(*docTypeRepo);
parseDocumentSelection(*docTypeRepo);
}
diff --git a/storage/src/vespa/storage/persistence/testandsethelper.h b/storage/src/vespa/storage/persistence/testandsethelper.h
index b528b5034f9..f2c55d5ba11 100644
--- a/storage/src/vespa/storage/persistence/testandsethelper.h
+++ b/storage/src/vespa/storage/persistence/testandsethelper.h
@@ -28,7 +28,7 @@ class TestAndSetHelper {
std::unique_ptr<document::select::Node> _docSelectionUp;
bool _missingDocumentImpliesMatch;
- void getDocumentType(const document::DocumentTypeRepo & documentTypeRepo);
+ void resolveDocumentType(const document::DocumentTypeRepo & documentTypeRepo);
void parseDocumentSelection(const document::DocumentTypeRepo & documentTypeRepo);
spi::GetResult retrieveDocument(const document::FieldSet & fieldSet, spi::Context & context);