diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-08-04 14:03:49 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-08-04 14:03:49 +0000 |
commit | db49d6d264873e7faf0e5df0a6dec42cc94888e8 (patch) | |
tree | d3a3df7f4d5f9c912489aa61d53efd9200e7ebed /storageapi/src | |
parent | bdc43e2dda007965b770cd0a778d6a2f2634d276 (diff) |
Use named constants instead of strings sprinkled all over.
Diffstat (limited to 'storageapi/src')
-rw-r--r-- | storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp | 13 | ||||
-rw-r--r-- | storageapi/src/vespa/storageapi/message/visitor.cpp | 4 |
2 files changed, 10 insertions, 7 deletions
diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp index 0cfd2160497..8deb689d3a8 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp @@ -10,11 +10,13 @@ #include <vespa/storageapi/message/visitor.h> #include <vespa/storageapi/message/removelocation.h> #include <vespa/vespalib/util/exceptions.h> +#include <vespa/document/fieldset/fieldsets.h> #include <vespa/log/log.h> LOG_SETUP(".storage.api.mbusprot.serialization.4_2"); using document::BucketSpace; +using document::AllFields; namespace storage::mbusprot { @@ -29,7 +31,7 @@ void ProtocolSerialization4_2::onEncode(GBBuf& buf, const api::GetCommand& msg) buf.putString(msg.getDocumentId().toString()); putBucket(msg.getBucket(), buf); buf.putLong(msg.getBeforeTimestamp()); - buf.putBoolean(msg.getFieldSet() == "[header]"); + buf.putBoolean(false); onEncodeCommand(buf, msg); } @@ -39,8 +41,9 @@ ProtocolSerialization4_2::onDecodeGetCommand(BBuf& buf) const document::DocumentId did(SH::getString(buf)); document::Bucket bucket = getBucket(buf); api::Timestamp beforeTimestamp(SH::getLong(buf)); - bool headerOnly(SH::getBoolean(buf)); - auto msg = std::make_unique<api::GetCommand>(bucket, did, headerOnly ? "[header]" : "[all]", beforeTimestamp); + bool headerOnly(SH::getBoolean(buf)); // Ignored header only flag + (void) headerOnly; + auto msg = std::make_unique<api::GetCommand>(bucket, did, AllFields::NAME, beforeTimestamp); onDecodeCommand(buf, *msg); return msg; } @@ -371,7 +374,7 @@ ProtocolSerialization4_2::onEncode(GBBuf& buf, const api::CreateVisitorCommand& } buf.putBoolean(msg.visitRemoves()); - buf.putBoolean(msg.getFieldSet() == "[header]"); + buf.putBoolean(false); buf.putBoolean(msg.visitInconsistentBuckets()); buf.putInt(vespalib::count_ms(msg.getQueueTimeout())); msg.getParameters().serialize(buf); @@ -409,7 +412,7 @@ ProtocolSerialization4_2::onDecodeCreateVisitorCommand(BBuf& buf) const msg->setVisitRemoves(); } if (SH::getBoolean(buf)) { - msg->setFieldSet("[header]"); + msg->setFieldSet(AllFields::NAME); } if (SH::getBoolean(buf)) { msg->setVisitInconsistentBuckets(); diff --git a/storageapi/src/vespa/storageapi/message/visitor.cpp b/storageapi/src/vespa/storageapi/message/visitor.cpp index e531e73fea5..faf58361276 100644 --- a/storageapi/src/vespa/storageapi/message/visitor.cpp +++ b/storageapi/src/vespa/storageapi/message/visitor.cpp @@ -1,9 +1,9 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "visitor.h" +#include <vespa/document/fieldset/fieldsets.h> #include <vespa/vespalib/util/array.hpp> #include <climits> -#include <ostream> namespace storage::api { @@ -32,7 +32,7 @@ CreateVisitorCommand::CreateVisitorCommand(document::BucketSpace bucketSpace, _instanceId(instanceId), _visitorId(0), _visitRemoves(false), - _fieldSet("[all]"), + _fieldSet(document::AllFields::NAME), _visitInconsistentBuckets(false), _queueTimeout(2000ms), _maxPendingReplyCount(2), |