diff options
author | Tor Egge <Tor.Egge@oath.com> | 2017-10-18 12:36:24 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-10-18 12:36:24 +0000 |
commit | 00673fd58679212a69a5f51ff255a90c2fff9271 (patch) | |
tree | b75044ce6c4c2d5bf759ee024b55c95b07cc57f3 | |
parent | 8530d49ee9f6e4e6cf613d59bc454d39082046b3 (diff) |
Remove DocBlockCommand and DocBlockReply from storage api.
7 files changed, 0 insertions, 219 deletions
diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.cpp b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.cpp index 504b3fcdf4f..fda99ed2f00 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.cpp @@ -270,36 +270,6 @@ RoutableFactories50::DestroyVisitorReplyFactory::doEncode(const DocumentReply &o } DocumentMessage::UP -RoutableFactories50::DocBlockMessageFactory::doDecode(document::ByteBuffer &buf) const -{ - (void)buf; - return DocumentMessage::UP(); // TODO: remove message type -} - -bool -RoutableFactories50::DocBlockMessageFactory::doEncode(const DocumentMessage &obj, vespalib::GrowableByteBuffer &buf) const -{ - (void)obj; - (void)buf; - return false; -} - -DocumentReply::UP -RoutableFactories50::DocBlockReplyFactory::doDecode(document::ByteBuffer &buf) const -{ - (void)buf; - return DocumentReply::UP(); // TODO: remove reply type -} - -bool -RoutableFactories50::DocBlockReplyFactory::doEncode(const DocumentReply &obj, vespalib::GrowableByteBuffer &buf) const -{ - (void)obj; - (void)buf; - return false; -} - -DocumentMessage::UP RoutableFactories50::DocumentListMessageFactory::doDecode(document::ByteBuffer &buf) const { DocumentMessage::UP ret(new DocumentListMessage()); diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h index cf9f223ab3b..102b7f16c43 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h +++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h @@ -200,16 +200,6 @@ public: DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; - class DocBlockMessageFactory : public DocumentMessageFactory { - protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; - }; - class DocBlockReplyFactory : public DocumentReplyFactory { - protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; - }; class DocumentListMessageFactory : public DocumentMessageFactory { const document::DocumentTypeRepo &_repo; DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; diff --git a/storage/src/tests/storageserver/documentapiconvertertest.cpp b/storage/src/tests/storageserver/documentapiconvertertest.cpp index ff261e88922..224dc8b9a9b 100644 --- a/storage/src/tests/storageserver/documentapiconvertertest.cpp +++ b/storage/src/tests/storageserver/documentapiconvertertest.cpp @@ -52,8 +52,6 @@ struct DocumentApiConverterTest : public CppUnit::TestFixture void testCreateVisitorReplyLastBucket(); void testDestroyVisitor(); void testVisitorInfo(); - void testDocBlock(); - void testDocBlockWithKeepTimeStamps(); void testMultiOperation(); void testBatchDocumentUpdate(); @@ -68,8 +66,6 @@ struct DocumentApiConverterTest : public CppUnit::TestFixture CPPUNIT_TEST(testCreateVisitorReplyLastBucket); CPPUNIT_TEST(testDestroyVisitor); CPPUNIT_TEST(testVisitorInfo); - CPPUNIT_TEST(testDocBlock); - CPPUNIT_TEST(testDocBlockWithKeepTimeStamps); CPPUNIT_TEST(testMultiOperation); CPPUNIT_TEST(testBatchDocumentUpdate); CPPUNIT_TEST_SUITE_END(); @@ -270,74 +266,6 @@ DocumentApiConverterTest::testVisitorInfo() } void -DocumentApiConverterTest::testDocBlock() -{ - Document::SP doc(new Document(_html_type, DocumentId(DocIdString("test", "test")))); - - char buffer[10000]; - vdslib::WritableDocumentList docBlock(_repo, buffer, sizeof(buffer)); - docBlock.addPut(*doc, 100); - - document::BucketIdFactory fac; - document::BucketId bucketId = fac.getBucketId(doc->getId()); - bucketId.setUsedBits(32); - - api::DocBlockCommand dbcmd(bucketId, docBlock, std::shared_ptr<void>()); - dbcmd.setTimeout(123456); - - std::unique_ptr<mbus::Message> mbusmsg = _converter->toDocumentAPI(dbcmd, _repo); - - documentapi::MultiOperationMessage* mbusdb = dynamic_cast<documentapi::MultiOperationMessage*>(mbusmsg.get()); - CPPUNIT_ASSERT(mbusdb); - - CPPUNIT_ASSERT_EQUAL((uint64_t)123456, mbusdb->getTimeRemaining()); - - const vdslib::DocumentList& list = mbusdb->getOperations(); - CPPUNIT_ASSERT_EQUAL((uint32_t)1, list.size()); - CPPUNIT_ASSERT_EQUAL(*doc, *dynamic_cast<document::Document*>(list.begin()->getDocument().get())); - - std::unique_ptr<mbus::Reply> reply = mbusdb->createReply(); - CPPUNIT_ASSERT(reply.get()); - - std::unique_ptr<storage::api::StorageReply> rep = - _converter->toStorageAPI(static_cast<documentapi::DocumentReply&>(*reply), dbcmd); - api::DocBlockReply* pr = dynamic_cast<api::DocBlockReply*>(rep.get()); - CPPUNIT_ASSERT(pr); -} - - -void -DocumentApiConverterTest::testDocBlockWithKeepTimeStamps() -{ - char buffer[10000]; - vdslib::WritableDocumentList docBlock(_repo, buffer, sizeof(buffer)); - api::DocBlockCommand dbcmd(document::BucketId(0), docBlock, std::shared_ptr<void>()); - - { - CPPUNIT_ASSERT_EQUAL(dbcmd.keepTimeStamps(), false); - - std::unique_ptr<mbus::Message> mbusmsg = _converter->toDocumentAPI(dbcmd, _repo); - - documentapi::MultiOperationMessage* mbusdb = dynamic_cast<documentapi::MultiOperationMessage*>(mbusmsg.get()); - CPPUNIT_ASSERT(mbusdb); - CPPUNIT_ASSERT_EQUAL(mbusdb->keepTimeStamps(), false); - } - - { - dbcmd.keepTimeStamps(true); - CPPUNIT_ASSERT_EQUAL(dbcmd.keepTimeStamps(), true); - - std::unique_ptr<mbus::Message> mbusmsg = _converter->toDocumentAPI(dbcmd, _repo); - - documentapi::MultiOperationMessage* mbusdb = dynamic_cast<documentapi::MultiOperationMessage*>(mbusmsg.get()); - CPPUNIT_ASSERT(mbusdb); - CPPUNIT_ASSERT_EQUAL(mbusdb->keepTimeStamps(), true); - } - -} - - -void DocumentApiConverterTest::testMultiOperation() { //create a document diff --git a/storage/src/vespa/storage/storageserver/documentapiconverter.cpp b/storage/src/vespa/storage/storageserver/documentapiconverter.cpp index 0602cb6de38..e8d99bc3939 100644 --- a/storage/src/vespa/storage/storageserver/documentapiconverter.cpp +++ b/storage/src/vespa/storage/storageserver/documentapiconverter.cpp @@ -244,13 +244,6 @@ DocumentApiConverter::toDocumentAPI(api::StorageCommand& fromMsg, const document toMsg = std::move(to); break; } - case api::MessageType::DOCBLOCK_ID: - { - api::DocBlockCommand& from(static_cast<api::DocBlockCommand&>(fromMsg)); - toMsg = std::make_unique<documentapi::MultiOperationMessage>(from.getBucketId(), from.getDocumentBlock(), - from.keepTimeStamps()); - break; - } case api::MessageType::SEARCHRESULT_ID: { api::SearchResultCommand& from(static_cast<api::SearchResultCommand&>(fromMsg)); diff --git a/storageapi/src/vespa/storageapi/message/datagram.cpp b/storageapi/src/vespa/storageapi/message/datagram.cpp index c2fc347c597..4967c1fd82d 100644 --- a/storageapi/src/vespa/storageapi/message/datagram.cpp +++ b/storageapi/src/vespa/storageapi/message/datagram.cpp @@ -7,8 +7,6 @@ using document::BucketSpace; namespace storage { namespace api { -IMPLEMENT_COMMAND(DocBlockCommand, DocBlockReply) -IMPLEMENT_REPLY(DocBlockReply) IMPLEMENT_COMMAND(MapVisitorCommand, MapVisitorReply) IMPLEMENT_REPLY(MapVisitorReply) IMPLEMENT_COMMAND(DocumentListCommand, DocumentListReply) @@ -16,49 +14,6 @@ IMPLEMENT_REPLY(DocumentListReply) IMPLEMENT_COMMAND(EmptyBucketsCommand, EmptyBucketsReply) IMPLEMENT_REPLY(EmptyBucketsReply) -DocBlockCommand::DocBlockCommand(const document::BucketId& bucketId, - const vdslib::DocumentList& block, - const std::shared_ptr<void>& buffer) - : StorageCommand(MessageType::DOCBLOCK), - _bucket(BucketSpace::placeHolder(), bucketId), - _docBlock(block), - _buffer(buffer), - _keepTimeStamps(false) -{ -} - -DocBlockCommand::~DocBlockCommand() {} - -void -DocBlockCommand::print(std::ostream& out, bool verbose, - const std::string& indent) const -{ - out << "DocBlockCommand(" - << "size " << _docBlock.getBufferSize() << ", used space " - << (_docBlock.getBufferSize() - _docBlock.countFree()) << ", doccount " - << _docBlock.size() << ")"; - if (verbose) { - out << " : "; - StorageCommand::print(out, verbose, indent); - } -} - -DocBlockReply::DocBlockReply(const DocBlockCommand& cmd) - : StorageReply(cmd) -{ -} - -void -DocBlockReply::print(std::ostream& out, bool verbose, - const std::string& indent) const -{ - out << "DocBlockReply()"; - if (verbose) { - out << " : "; - StorageReply::print(out, verbose, indent); - } -} - MapVisitorCommand::MapVisitorCommand() : StorageCommand(MessageType::MAPVISITOR) { diff --git a/storageapi/src/vespa/storageapi/message/datagram.h b/storageapi/src/vespa/storageapi/message/datagram.h index 272ba72364e..32f9bea6a95 100644 --- a/storageapi/src/vespa/storageapi/message/datagram.h +++ b/storageapi/src/vespa/storageapi/message/datagram.h @@ -10,53 +10,6 @@ namespace storage::api { /** - * @class DocBlockCommand - * @ingroup message - * - * @brief Sends a docblock to a visitor or subscriber. - */ -class DocBlockCommand : public StorageCommand { - document::Bucket _bucket; - vdslib::DocumentList _docBlock; - std::shared_ptr<void> _buffer; // Owns data in docblock - bool _keepTimeStamps; // Used for recovery/synchronization where we want to - // keep the timestamps of the origin. - -public: - DocBlockCommand(const document::BucketId& bucketId, - const vdslib::DocumentList& block, - const std::shared_ptr<void>& buffer); - ~DocBlockCommand(); - - vdslib::DocumentList& getDocumentBlock() - { assert(_docBlock.getBufferSize() > 0); return _docBlock; } - const vdslib::DocumentList& getDocumentBlock() const - { assert(_docBlock.getBufferSize() > 0); return _docBlock; } - void setDocumentBlock(vdslib::DocumentList& block) { _docBlock = block; } - - document::Bucket getBucket() const override { return _bucket; } - bool hasSingleBucketId() const override { return true; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - bool keepTimeStamps() const { return _keepTimeStamps; } - void keepTimeStamps(bool keepTime) { _keepTimeStamps = keepTime; } - - DECLARE_STORAGECOMMAND(DocBlockCommand, onDocBlock) -}; - -/** - * @class DocBlockReply - * @ingroup message - * - * @brief Confirm that a given docblock have been received. - */ -class DocBlockReply : public StorageReply { -public: - explicit DocBlockReply(const DocBlockCommand&); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(DocBlockReply, onDocBlockReply) -}; - -/** * @class MapStorageCommand * @ingroup message * diff --git a/storageapi/src/vespa/storageapi/messageapi/messagehandler.h b/storageapi/src/vespa/storageapi/messageapi/messagehandler.h index 8f571ff0f40..1b9c423e78b 100644 --- a/storageapi/src/vespa/storageapi/messageapi/messagehandler.h +++ b/storageapi/src/vespa/storageapi/messageapi/messagehandler.h @@ -32,7 +32,6 @@ class BatchDocumentUpdateCommand; class CreateVisitorCommand; // Create a new visitor class DestroyVisitorCommand; // Destroy a running visitor class VisitorInfoCommand; // Sends visitor info to visitor controller -class DocBlockCommand; // A block of documents visited class MapVisitorCommand; class SearchResultCommand; class DocumentSummaryCommand; @@ -73,7 +72,6 @@ class BatchDocumentUpdateReply; class CreateVisitorReply; class DestroyVisitorReply; class VisitorInfoReply; -class DocBlockReply; class MapVisitorReply; class SearchResultReply; class DocumentSummaryReply; @@ -188,12 +186,6 @@ public: virtual bool onVisitorInfoReply( const std::shared_ptr<api::VisitorInfoReply>&) { return false; } - virtual bool onDocBlock( - const std::shared_ptr<api::DocBlockCommand>&) - { return false; } - virtual bool onDocBlockReply( - const std::shared_ptr<api::DocBlockReply>&) - { return false; } virtual bool onMapVisitor( const std::shared_ptr<api::MapVisitorCommand>&) { return false; } |