diff options
Diffstat (limited to 'documentapi/src/vespa/documentapi/messagebus/routablefactories51.cpp')
-rw-r--r-- | documentapi/src/vespa/documentapi/messagebus/routablefactories51.cpp | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories51.cpp b/documentapi/src/vespa/documentapi/messagebus/routablefactories51.cpp deleted file mode 100644 index 01d0c5b6c0e..00000000000 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories51.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include "routablefactories51.h" -#include <vespa/document/bucket/fixed_bucket_spaces.h> -#include <vespa/document/document.h> -#include <vespa/documentapi/documentapi.h> -#include <vespa/documentapi/loadtypes/loadtypeset.h> -#include <vespa/vespalib/objects/nbostream.h> - -using document::FixedBucketSpaces; -using vespalib::nbostream; - -namespace documentapi { - -DocumentMessage::UP -RoutableFactories51::CreateVisitorMessageFactory::doDecode(document::ByteBuffer &buf) const -{ - DocumentMessage::UP ret(new CreateVisitorMessage()); - CreateVisitorMessage &msg = static_cast<CreateVisitorMessage&>(*ret); - - msg.setLibraryName(decodeString(buf)); - msg.setInstanceId(decodeString(buf)); - msg.setControlDestination(decodeString(buf)); - msg.setDataDestination(decodeString(buf)); - msg.setDocumentSelection(decodeString(buf)); - msg.setMaximumPendingReplyCount(decodeInt(buf)); - - int32_t len = decodeInt(buf); - msg.getBuckets().reserve(len); - for (int32_t i = 0; i < len; i++) { - int64_t val; - buf.getLong(val); // NOT using getLongNetwork - msg.getBuckets().push_back(document::BucketId(val)); - } - - msg.setFromTimestamp(decodeLong(buf)); - msg.setToTimestamp(decodeLong(buf)); - msg.setVisitRemoves(decodeBoolean(buf)); - msg.setFieldSet(decodeString(buf)); - msg.setVisitInconsistentBuckets(decodeBoolean(buf)); - msg.getParameters().deserialize(_repo, buf); - msg.setVisitorDispatcherVersion(50); - msg.setVisitorOrdering((document::OrderingSpecification::Order)decodeInt(buf)); - msg.setMaxBucketsPerVisitor(decodeInt(buf)); - msg.setBucketSpace(decodeBucketSpace(buf)); - - return ret; -} - -bool -RoutableFactories51::CreateVisitorMessageFactory::doEncode(const DocumentMessage &obj, vespalib::GrowableByteBuffer &buf) const -{ - const CreateVisitorMessage &msg = static_cast<const CreateVisitorMessage&>(obj); - - buf.putString(msg.getLibraryName()); - buf.putString(msg.getInstanceId()); - buf.putString(msg.getControlDestination()); - buf.putString(msg.getDataDestination()); - buf.putString(msg.getDocumentSelection()); - buf.putInt(msg.getMaximumPendingReplyCount()); - buf.putInt(msg.getBuckets().size()); - - const std::vector<document::BucketId> &buckets = msg.getBuckets(); - for (std::vector<document::BucketId>::const_iterator it = buckets.begin(); - it != buckets.end(); ++it) - { - uint64_t val = it->getRawId(); - buf.putBytes((const char*)&val, 8); - } - - buf.putLong(msg.getFromTimestamp()); - buf.putLong(msg.getToTimestamp()); - buf.putBoolean(msg.visitRemoves()); - buf.putString(msg.getFieldSet()); - buf.putBoolean(msg.visitInconsistentBuckets()); - - int len = msg.getParameters().getSerializedSize(); - char *tmp = buf.allocate(len); - document::ByteBuffer dbuf(tmp, len); - msg.getParameters().serialize(dbuf); - - buf.putInt(msg.getVisitorOrdering()); - buf.putInt(msg.getMaxBucketsPerVisitor()); - return encodeBucketSpace(msg.getBucketSpace(), buf); -} - -bool RoutableFactories51::CreateVisitorMessageFactory::encodeBucketSpace( - vespalib::stringref bucketSpace, - vespalib::GrowableByteBuffer& buf) const { - (void) buf; - return (bucketSpace == FixedBucketSpaces::default_space_name()); -} - -string RoutableFactories51::CreateVisitorMessageFactory::decodeBucketSpace(document::ByteBuffer&) const { - return FixedBucketSpaces::default_space_name(); -} - -DocumentMessage::UP -RoutableFactories51::GetDocumentMessageFactory::doDecode(document::ByteBuffer &buf) const -{ - return DocumentMessage::UP( - new GetDocumentMessage(decodeDocumentId(buf), - decodeString(buf))); -} - -bool -RoutableFactories51::GetDocumentMessageFactory::doEncode(const DocumentMessage &obj, - vespalib::GrowableByteBuffer &buf) const -{ - const GetDocumentMessage &msg = static_cast<const GetDocumentMessage&>(obj); - - encodeDocumentId(msg.getDocumentId(), buf); - buf.putString(msg.getFieldSet()); - return true; -} - -DocumentReply::UP -RoutableFactories51::DocumentIgnoredReplyFactory::doDecode(document::ByteBuffer& buf) const -{ - (void) buf; - return DocumentReply::UP(new DocumentIgnoredReply()); -} - -bool -RoutableFactories51::DocumentIgnoredReplyFactory::doEncode( - const DocumentReply& obj, - vespalib::GrowableByteBuffer& buf) const -{ - (void) obj; - (void) buf; - return true; -} - -} |