diff options
author | Arne H Juul <arnej27959@users.noreply.github.com> | 2017-04-24 12:10:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-24 12:10:42 +0200 |
commit | 9ff4bdb407ed8d855a3f86a17c99906ff738177b (patch) | |
tree | fc2b050224d7dde92d57e1f9cac12c1e5aaf6b90 /storageapi | |
parent | 32ae190acc9ac5081049e1c7008d1602c68cf821 (diff) |
Revert "Balder/enforce override 2"
Diffstat (limited to 'storageapi')
32 files changed, 448 insertions, 218 deletions
diff --git a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp index ed59b49ff04..bc71429032e 100644 --- a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp +++ b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp @@ -1,5 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/document/base/testdocman.h> +#include <vespa/document/document.h> +#include <vespa/document/repo/documenttyperepo.h> +#include <vespa/document/update/fieldpathupdates.h> +#include <iomanip> +#include <sstream> #include <vespa/storageapi/message/persistence.h> #include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/bucketsplitting.h> @@ -10,16 +16,10 @@ #include <vespa/storageapi/mbusprot/storageprotocol.h> #include <vespa/storageapi/mbusprot/storagecommand.h> #include <vespa/storageapi/mbusprot/storagereply.h> -#include <vespa/storageapi/message/visitor.h> -#include <vespa/document/base/testdocman.h> -#include <vespa/document/document.h> -#include <vespa/document/repo/documenttyperepo.h> -#include <vespa/document/update/fieldpathupdates.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/vespalib/util/growablebytebuffer.h> +#include <vespa/storageapi/message/visitor.h> #include <vespa/vespalib/objects/nbostream.h> -#include <iomanip> -#include <sstream> using std::shared_ptr; using document::ByteBuffer; @@ -837,7 +837,8 @@ namespace { api::StorageReply::UP makeReply() override; - void print(std::ostream& out, bool verbose, const std::string& indent) const override { + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override + { out << "MyCommand()"; if (verbose) { out << " : "; @@ -849,7 +850,8 @@ namespace { struct MyReply : public api::InternalReply { MyReply(const MyCommand& cmd) : InternalReply(102, cmd) {} - void print(std::ostream& out, bool verbose, const std::string& indent) const override { + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override + { out << "MyReply()"; if (verbose) { out << " : "; diff --git a/storageapi/src/tests/testrunner.cpp b/storageapi/src/tests/testrunner.cpp index 05fb3184c04..9a07796a3f4 100644 --- a/storageapi/src/tests/testrunner.cpp +++ b/storageapi/src/tests/testrunner.cpp @@ -1,12 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/log/log.h> #include <vespa/vdstestlib/cppunit/cppunittestrunner.h> -#include <vespa/log/log.h> LOG_SETUP("storageapicppunittestrunner"); int -main(int argc, const char *argv[]) +main(int argc, char **argv) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); diff --git a/storageapi/src/vespa/storageapi/buckets/bucketinfo.h b/storageapi/src/vespa/storageapi/buckets/bucketinfo.h index 17ad75aa851..692cc171250 100644 --- a/storageapi/src/vespa/storageapi/buckets/bucketinfo.h +++ b/storageapi/src/vespa/storageapi/buckets/bucketinfo.h @@ -13,6 +13,7 @@ #pragma once +#include <stdint.h> #include <vespa/storageapi/defs.h> #include <vespa/vespalib/util/printable.h> #include <vespa/vespalib/util/xmlserializable.h> @@ -76,10 +77,13 @@ public: bool empty() const { return _metaCount == 0 && _usedFileSize == 0 && _checksum == 0; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override { + + void print(std::ostream& out, bool verbose, + const std::string& indent) const override + { vespalib::AsciiPrintable::print(out, verbose, indent); } - void print(vespalib::asciistream&, const PrintProperties&) const override; + virtual void print(vespalib::asciistream&, const PrintProperties&) const override; void printXml(vespalib::XmlOutputStream&) const; }; diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.h index f44de9700b7..9fa125b1159 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.h @@ -1,7 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "protocolserialization.h" +#include <vespa/storageapi/mbusprot/protocolserialization.h> namespace storage { namespace mbusprot { @@ -11,29 +11,29 @@ public: ProtocolSerialization4_2(const document::DocumentTypeRepo::SP&); protected: - void onEncode(GBBuf&, const api::GetCommand&) const override; - void onEncode(GBBuf&, const api::RemoveCommand&) const override; - void onEncode(GBBuf&, const api::RevertCommand&) const override; - void onEncode(GBBuf&, const api::CreateBucketCommand&) const override; - void onEncode(GBBuf&, const api::MergeBucketCommand&) const override; - void onEncode(GBBuf&, const api::GetBucketDiffCommand&) const override; - void onEncode(GBBuf&, const api::ApplyBucketDiffCommand&) const override; - void onEncode(GBBuf&, const api::RequestBucketInfoReply&) const override; - void onEncode(GBBuf&, const api::NotifyBucketChangeCommand&) const override; - void onEncode(GBBuf&, const api::NotifyBucketChangeReply&) const override; - void onEncode(GBBuf&, const api::SplitBucketCommand&) const override; - void onEncode(GBBuf&, const api::MultiOperationCommand&) const override; - void onEncode(GBBuf&, const api::CreateVisitorCommand&) const override; - void onEncode(GBBuf&, const api::DestroyVisitorCommand&) const override; - void onEncode(GBBuf&, const api::DestroyVisitorReply&) const override; - void onEncode(GBBuf&, const api::RemoveLocationCommand&) const override; - void onEncode(GBBuf&, const api::RemoveLocationReply&) const override; + virtual void onEncode(GBBuf&, const api::GetCommand&) const override; + virtual void onEncode(GBBuf&, const api::RemoveCommand&) const override; + virtual void onEncode(GBBuf&, const api::RevertCommand&) const override; + virtual void onEncode(GBBuf&, const api::CreateBucketCommand&) const override; + virtual void onEncode(GBBuf&, const api::MergeBucketCommand&) const override; + virtual void onEncode(GBBuf&, const api::GetBucketDiffCommand&) const override; + virtual void onEncode(GBBuf&, const api::ApplyBucketDiffCommand&) const override; + virtual void onEncode(GBBuf&, const api::RequestBucketInfoReply&) const override; + virtual void onEncode(GBBuf&, const api::NotifyBucketChangeCommand&) const override; + virtual void onEncode(GBBuf&, const api::NotifyBucketChangeReply&) const override; + virtual void onEncode(GBBuf&, const api::SplitBucketCommand&) const override; + virtual void onEncode(GBBuf&, const api::MultiOperationCommand&) const override; + virtual void onEncode(GBBuf&, const api::CreateVisitorCommand&) const override; + virtual void onEncode(GBBuf&, const api::DestroyVisitorCommand&) const override; + virtual void onEncode(GBBuf&, const api::DestroyVisitorReply&) const override; + virtual void onEncode(GBBuf&, const api::RemoveLocationCommand&) const override; + virtual void onEncode(GBBuf&, const api::RemoveLocationReply&) const override; // Not supported on 4.2, but implemented here for simplicity. - void onEncode(GBBuf&, const api::BatchPutRemoveCommand&) const override; - void onEncode(GBBuf&, const api::BatchPutRemoveReply&) const override; - void onEncode(GBBuf&, const api::SetBucketStateCommand&) const override; - void onEncode(GBBuf&, const api::SetBucketStateReply&) const override; + virtual void onEncode(GBBuf&, const api::BatchPutRemoveCommand&) const override; + virtual void onEncode(GBBuf&, const api::BatchPutRemoveReply&) const override; + virtual void onEncode(GBBuf&, const api::SetBucketStateCommand&) const override; + virtual void onEncode(GBBuf&, const api::SetBucketStateReply&) const override; virtual void onEncodeBucketInfoCommand(GBBuf&, const api::BucketInfoCommand&) const; virtual void onEncodeBucketInfoReply(GBBuf&, const api::BucketInfoReply&) const = 0; @@ -42,29 +42,29 @@ protected: virtual void onEncodeDiffEntry(GBBuf&, const api::GetBucketDiffCommand::Entry&) const; virtual void onEncode(GBBuf&, const api::ReturnCode&) const; - SCmd::UP onDecodeGetCommand(BBuf&) const override; - SCmd::UP onDecodeRemoveCommand(BBuf&) const override; - SCmd::UP onDecodeRevertCommand(BBuf&) const override; - SCmd::UP onDecodeCreateBucketCommand(BBuf&) const override; - SCmd::UP onDecodeMergeBucketCommand(BBuf&) const override; - SCmd::UP onDecodeGetBucketDiffCommand(BBuf&) const override; - SCmd::UP onDecodeApplyBucketDiffCommand(BBuf&) const override; - SRep::UP onDecodeRequestBucketInfoReply(const SCmd&, BBuf&) const override; - SCmd::UP onDecodeNotifyBucketChangeCommand(BBuf&) const override; - SRep::UP onDecodeNotifyBucketChangeReply(const SCmd&, BBuf&) const override; - SCmd::UP onDecodeSplitBucketCommand(BBuf&) const override; - SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const override; - SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const override; - SCmd::UP onDecodeMultiOperationCommand(BBuf&) const override; - SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; - SCmd::UP onDecodeDestroyVisitorCommand(BBuf&) const override; - SRep::UP onDecodeDestroyVisitorReply(const SCmd&, BBuf&) const override; - SCmd::UP onDecodeRemoveLocationCommand(BBuf&) const override; - SRep::UP onDecodeRemoveLocationReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeGetCommand(BBuf&) const override; + virtual SCmd::UP onDecodeRemoveCommand(BBuf&) const override; + virtual SCmd::UP onDecodeRevertCommand(BBuf&) const override; + virtual SCmd::UP onDecodeCreateBucketCommand(BBuf&) const override; + virtual SCmd::UP onDecodeMergeBucketCommand(BBuf&) const override; + virtual SCmd::UP onDecodeGetBucketDiffCommand(BBuf&) const override; + virtual SCmd::UP onDecodeApplyBucketDiffCommand(BBuf&) const override; + virtual SRep::UP onDecodeRequestBucketInfoReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeNotifyBucketChangeCommand(BBuf&) const override; + virtual SRep::UP onDecodeNotifyBucketChangeReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeSplitBucketCommand(BBuf&) const override; + virtual SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const override; + virtual SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeMultiOperationCommand(BBuf&) const override; + virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; + virtual SCmd::UP onDecodeDestroyVisitorCommand(BBuf&) const override; + virtual SRep::UP onDecodeDestroyVisitorReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeRemoveLocationCommand(BBuf&) const override; + virtual SRep::UP onDecodeRemoveLocationReply(const SCmd&, BBuf&) const override; // Not supported on 4.2, but implemented here for simplicity. - SCmd::UP onDecodeBatchPutRemoveCommand(BBuf&) const override; - SRep::UP onDecodeBatchPutRemoveReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeBatchPutRemoveCommand(BBuf&) const override; + virtual SRep::UP onDecodeBatchPutRemoveReply(const SCmd&, BBuf&) const override; virtual void onDecodeBucketInfoCommand(BBuf&, api::BucketInfoCommand&) const; virtual void onDecodeBucketInfoReply(BBuf&, api::BucketInfoReply&) const = 0; diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.h index 826700584da..c5a26987a08 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.h @@ -1,7 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "protocolserialization4_2.h" +#include <vespa/storageapi/mbusprot/protocolserialization4_2.h> #include <vespa/documentapi/loadtypes/loadtypeset.h> namespace storage { @@ -15,64 +15,66 @@ public: ProtocolSerialization5_0(const document::DocumentTypeRepo::SP&, const documentapi::LoadTypeSet& loadTypes); - api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const override; - void putBucketInfo(const api::BucketInfo& info, vespalib::GrowableByteBuffer& buf) const override; + virtual api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const override; + virtual void putBucketInfo(const api::BucketInfo& info, + vespalib::GrowableByteBuffer& buf) const override; - void onEncode(GBBuf&, const api::PutCommand&) const override; - void onEncode(GBBuf&, const api::PutReply&) const override; - void onEncode(GBBuf&, const api::UpdateCommand&) const override; - void onEncode(GBBuf&, const api::UpdateReply&) const override; - void onEncode(GBBuf&, const api::GetReply&) const override; - void onEncode(GBBuf&, const api::RemoveReply&) const override; - void onEncode(GBBuf&, const api::RevertReply&) const override; - void onEncode(GBBuf&, const api::CreateBucketReply&) const override; - void onEncode(GBBuf&, const api::DeleteBucketCommand&) const override; - void onEncode(GBBuf&, const api::DeleteBucketReply&) const override; - void onEncode(GBBuf&, const api::MergeBucketCommand&) const override; - void onEncode(GBBuf&, const api::MergeBucketReply&) const override; - void onEncode(GBBuf&, const api::GetBucketDiffReply&) const override; - void onEncode(GBBuf&, const api::ApplyBucketDiffReply&) const override; - void onEncode(GBBuf&, const api::SplitBucketReply&) const override; - void onEncode(GBBuf&, const api::MultiOperationReply&) const override; - void onEncode(GBBuf&, const api::JoinBucketsCommand&) const override; - void onEncode(GBBuf&, const api::JoinBucketsReply&) const override; - void onEncode(GBBuf&, const api::RequestBucketInfoCommand&) const override; + virtual void onEncode(GBBuf&, const api::PutCommand&) const override; + virtual void onEncode(GBBuf&, const api::PutReply&) const override; + virtual void onEncode(GBBuf&, const api::UpdateCommand&) const override; + virtual void onEncode(GBBuf&, const api::UpdateReply&) const override; + virtual void onEncode(GBBuf&, const api::GetReply&) const override; + virtual void onEncode(GBBuf&, const api::RemoveReply&) const override; + virtual void onEncode(GBBuf&, const api::RevertReply&) const override; + virtual void onEncode(GBBuf&, const api::CreateBucketReply&) const override; + virtual void onEncode(GBBuf&, const api::DeleteBucketCommand&) const override; + virtual void onEncode(GBBuf&, const api::DeleteBucketReply&) const override; + virtual void onEncode(GBBuf&, const api::MergeBucketCommand&) const override; + virtual void onEncode(GBBuf&, const api::MergeBucketReply&) const override; + virtual void onEncode(GBBuf&, const api::GetBucketDiffReply&) const override; + virtual void onEncode(GBBuf&, const api::ApplyBucketDiffReply&) const override; + virtual void onEncode(GBBuf&, const api::SplitBucketReply&) const override; + virtual void onEncode(GBBuf&, const api::MultiOperationReply&) const override; + virtual void onEncode(GBBuf&, const api::JoinBucketsCommand&) const override; + virtual void onEncode(GBBuf&, const api::JoinBucketsReply&) const override; + virtual void onEncode(GBBuf&, const api::RequestBucketInfoCommand&) const override; - void onEncodeBucketInfoReply(GBBuf&, const api::BucketInfoReply&) const override; + virtual void onEncodeBucketInfoReply(GBBuf&, const api::BucketInfoReply&) const override; virtual void onEncodeBucketReply(GBBuf&, const api::BucketReply&) const; - void onEncode(GBBuf&, const api::CreateVisitorCommand& msg) const override; - void onEncode(GBBuf&, const api::CreateVisitorReply& msg) const override; - void onEncodeCommand(GBBuf&, const api::StorageCommand&) const override; - void onEncodeReply(GBBuf&, const api::StorageReply&) const override; + virtual void onEncode(GBBuf&, const api::CreateVisitorCommand& msg) const override; + virtual void onEncode(GBBuf&, const api::CreateVisitorReply& msg) const override; + virtual void onEncodeCommand(GBBuf&, const api::StorageCommand&) const override; + virtual void onEncodeReply(GBBuf&, const api::StorageReply&) const override; - SCmd::UP onDecodePutCommand(BBuf&) const override; - SRep::UP onDecodePutReply(const SCmd&, BBuf&) const override; - SCmd::UP onDecodeUpdateCommand(BBuf&) const override; - SRep::UP onDecodeUpdateReply(const SCmd&, BBuf&) const override; - SRep::UP onDecodeGetReply(const SCmd&, BBuf&) const override; - SRep::UP onDecodeRemoveReply(const SCmd&, BBuf&) const override; - SRep::UP onDecodeRevertReply(const SCmd&, BBuf&) const override; - SRep::UP onDecodeCreateBucketReply(const SCmd&, BBuf&) const override; - SCmd::UP onDecodeDeleteBucketCommand(BBuf&) const override; - SRep::UP onDecodeDeleteBucketReply(const SCmd&, BBuf&) const override; - SCmd::UP onDecodeMergeBucketCommand(BBuf&) const override; - SRep::UP onDecodeMergeBucketReply(const SCmd&, BBuf&) const override; - SRep::UP onDecodeGetBucketDiffReply(const SCmd&, BBuf&) const override; - SRep::UP onDecodeApplyBucketDiffReply(const SCmd&, BBuf&) const override; - SRep::UP onDecodeSplitBucketReply(const SCmd&, BBuf&) const override; - SRep::UP onDecodeMultiOperationReply(const SCmd&, BBuf&) const override; - SCmd::UP onDecodeJoinBucketsCommand(BBuf& buf) const override; - SRep::UP onDecodeJoinBucketsReply(const SCmd& cmd, BBuf& buf) const override; - SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; - SCmd::UP onDecodeRequestBucketInfoCommand(BBuf& buf) const override; + virtual SCmd::UP onDecodePutCommand(BBuf&) const override; + virtual SRep::UP onDecodePutReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeUpdateCommand(BBuf&) const override; + virtual SRep::UP onDecodeUpdateReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeGetReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeRemoveReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeRevertReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeCreateBucketReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeDeleteBucketCommand(BBuf&) const override; + virtual SRep::UP onDecodeDeleteBucketReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeMergeBucketCommand(BBuf&) const override; + virtual SRep::UP onDecodeMergeBucketReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeGetBucketDiffReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeApplyBucketDiffReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeSplitBucketReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeMultiOperationReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeJoinBucketsCommand(BBuf& buf) const override; + virtual SRep::UP onDecodeJoinBucketsReply(const SCmd& cmd, BBuf& buf) const override; + virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; + virtual SCmd::UP onDecodeRequestBucketInfoCommand(BBuf& buf) const override; - void onDecodeBucketInfoReply(BBuf&, api::BucketInfoReply&) const override; + virtual void onDecodeBucketInfoReply(BBuf&, api::BucketInfoReply&) const override; virtual void onDecodeBucketReply(BBuf&, api::BucketReply&) const; - SRep::UP onDecodeCreateVisitorReply(const SCmd& cmd, BBuf& buf) const override; - void onDecodeCommand(BBuf& buf, api::StorageCommand& msg) const override; - void onDecodeReply(BBuf&, api::StorageReply&) const override; + virtual SRep::UP onDecodeCreateVisitorReply(const SCmd& cmd, BBuf& buf) const override; + virtual void onDecodeCommand(BBuf& buf, api::StorageCommand& msg) const override; + virtual void onDecodeReply(BBuf&, api::StorageReply&) const override; }; } // mbusprot } // storage + diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h index 92e559f5de9..393596046c2 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h @@ -1,7 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "protocolserialization5_0.h" +#include <vespa/storageapi/mbusprot/protocolserialization5_0.h> +#include <vespa/documentapi/loadtypes/loadtypeset.h> namespace storage { namespace mbusprot { @@ -16,22 +17,24 @@ public: ProtocolSerialization5_1(const document::DocumentTypeRepo::SP&, const documentapi::LoadTypeSet& loadTypes); - api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const override; - void putBucketInfo(const api::BucketInfo& info, vespalib::GrowableByteBuffer& buf) const override; + virtual api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const override; + virtual void putBucketInfo(const api::BucketInfo& info, + vespalib::GrowableByteBuffer& buf) const override; protected: - void onEncode(GBBuf&, const api::SetBucketStateCommand&) const override; - void onEncode(GBBuf&, const api::SetBucketStateReply&) const override; - void onEncode(GBBuf&, const api::GetCommand&) const override; - void onEncode(GBBuf&, const api::CreateVisitorCommand&) const override; - void onEncode(GBBuf&, const api::CreateBucketCommand&) const override; - - SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const override; - SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const override; - SCmd::UP onDecodeGetCommand(BBuf&) const override; - SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; - SCmd::UP onDecodeCreateBucketCommand(BBuf&) const override; + virtual void onEncode(GBBuf&, const api::SetBucketStateCommand&) const override; + virtual void onEncode(GBBuf&, const api::SetBucketStateReply&) const override; + virtual void onEncode(GBBuf&, const api::GetCommand&) const override; + virtual void onEncode(GBBuf&, const api::CreateVisitorCommand&) const override; + virtual void onEncode(GBBuf&, const api::CreateBucketCommand&) const override; + + virtual SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const override; + virtual SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeGetCommand(BBuf&) const override; + virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; + virtual SCmd::UP onDecodeCreateBucketCommand(BBuf&) const override; }; } // mbusprot } // storage + diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_2.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_2.h index 552d9ee3508..35af05d192b 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_2.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_2.h @@ -3,8 +3,9 @@ #pragma once -#include "protocolserialization5_1.h" #include <vespa/vespalib/util/growablebytebuffer.h> +#include <vespa/documentapi/loadtypes/loadtypeset.h> +#include <vespa/storageapi/mbusprot/protocolserialization5_1.h> #include <vespa/storageapi/message/persistence.h> namespace storage { @@ -13,19 +14,20 @@ namespace mbusprot { class ProtocolSerialization5_2 : public ProtocolSerialization5_1 { public: - ProtocolSerialization5_2(const document::DocumentTypeRepo::SP& repo, - const documentapi::LoadTypeSet & loadTypes) + ProtocolSerialization5_2( + const document::DocumentTypeRepo::SP& repo, + const documentapi::LoadTypeSet & loadTypes) : ProtocolSerialization5_1(repo, loadTypes) - {} + {} protected: - void onEncode(GBBuf &, const api::PutCommand &) const override; - void onEncode(GBBuf &, const api::RemoveCommand &) const override; - void onEncode(GBBuf &, const api::UpdateCommand &) const override; + virtual void onEncode(GBBuf &, const api::PutCommand &) const override; + virtual void onEncode(GBBuf &, const api::RemoveCommand &) const override; + virtual void onEncode(GBBuf &, const api::UpdateCommand &) const override; - SCmd::UP onDecodePutCommand(BBuf &) const override; - SCmd::UP onDecodeRemoveCommand(BBuf &) const override; - SCmd::UP onDecodeUpdateCommand(BBuf &) const override; + virtual SCmd::UP onDecodePutCommand(BBuf &) const override; + virtual SCmd::UP onDecodeRemoveCommand(BBuf &) const override; + virtual SCmd::UP onDecodeUpdateCommand(BBuf &) const override; static void decodeTasCondition(api::StorageCommand & cmd, BBuf & buf); static void encodeTasCondition(GBBuf & buf, const api::StorageCommand & cmd); diff --git a/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h b/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h index d6d95e2b1fe..8549df6077f 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h +++ b/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "storagemessage.h" -#include "storageprotocol.h" #include <vespa/messagebus/message.h> +#include <vespa/storageapi/mbusprot/storagemessage.h> +#include <vespa/storageapi/mbusprot/storageprotocol.h> #include <vespa/storageapi/messageapi/storagecommand.h> namespace storage { @@ -16,13 +16,15 @@ public: StorageCommand(const storage::api::StorageCommand::SP&); const mbus::string & getProtocol() const override { return StorageProtocol::NAME; } + uint32_t getType() const override { return _cmd->getType().getId(); } + const api::StorageCommand::SP& getCommand() { return _cmd; } api::StorageCommand::CSP getCommand() const { return _cmd; } - api::StorageMessage::SP getInternalMessage() override { return _cmd; } - api::StorageMessage::CSP getInternalMessage() const override { return _cmd; } + virtual api::StorageMessage::SP getInternalMessage() override { return _cmd; } + virtual api::StorageMessage::CSP getInternalMessage() const override { return _cmd; } - uint8_t priority() const override { + virtual uint8_t priority() const override { return ((getInternalMessage()->getPriority()) / 255) * 16; } @@ -32,3 +34,4 @@ private: } // mbusprot } // storage + diff --git a/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h b/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h index e1bcff1b27c..8c10ab1dfe1 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h +++ b/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h @@ -1,8 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "protocolserialization5_2.h" #include <vespa/messagebus/iprotocol.h> +#include <string> +#include <vespa/storageapi/mbusprot/protocolserialization5_0.h> +#include <vespa/storageapi/mbusprot/protocolserialization5_1.h> +#include <vespa/storageapi/mbusprot/protocolserialization5_2.h> +#include <vespa/documentapi/loadtypes/loadtypeset.h> namespace storage { namespace mbusprot { @@ -17,10 +21,17 @@ public: StorageProtocol(const document::DocumentTypeRepo::SP, const documentapi::LoadTypeSet& loadTypes); + // Implements IProtocol. const mbus::string& getName() const override { return NAME; } + + // Implements IProtocol. mbus::IRoutingPolicy::UP createPolicy(const mbus::string& name, const mbus::string& param) const override; + + // Implements IProtocol. mbus::Blob encode(const vespalib::Version&, const mbus::Routable&) const override; + + // Implements IProtocol. mbus::Routable::UP decode(const vespalib::Version&, mbus::BlobRef) const override; private: @@ -31,3 +42,6 @@ private: } // mbusprot } // storage + + + diff --git a/storageapi/src/vespa/storageapi/mbusprot/storagereply.h b/storageapi/src/vespa/storageapi/mbusprot/storagereply.h index 2e7dafc505f..aa7c827a32a 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/storagereply.h +++ b/storageapi/src/vespa/storageapi/mbusprot/storagereply.h @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "storagemessage.h" -#include "storageprotocol.h" #include <vespa/messagebus/reply.h> +#include <vespa/storageapi/mbusprot/storagemessage.h> +#include <vespa/storageapi/mbusprot/storageprotocol.h> #include <vespa/storageapi/messageapi/storagereply.h> namespace storage { @@ -20,19 +20,21 @@ public: StorageReply(const mbus::BlobRef& data, const ProtocolSerialization&); StorageReply(const api::StorageReply::SP& reply); - ~StorageReply(); + virtual ~StorageReply(); - const mbus::string& getProtocol() const override { return StorageProtocol::NAME; } + virtual const mbus::string& getProtocol() const override + { return StorageProtocol::NAME; } uint32_t getType() const override { return _mbusType; } const api::StorageReply::SP& getReply() { deserialize(); return _reply; } api::StorageReply::CSP getReply() const { deserialize(); return _reply; } + virtual api::StorageMessage::SP getInternalMessage() override + { deserialize(); return _reply; } + virtual api::StorageMessage::CSP getInternalMessage() const override + { deserialize(); return _reply; } - api::StorageMessage::SP getInternalMessage() override { deserialize(); return _reply; } - api::StorageMessage::CSP getInternalMessage() const override { deserialize(); return _reply; } - - uint8_t priority() const override { + virtual uint8_t priority() const override { if (_reply.get()) { return _reply->getPriority(); } @@ -46,3 +48,4 @@ private: } // mbusprot } // storage + diff --git a/storageapi/src/vespa/storageapi/message/batch.h b/storageapi/src/vespa/storageapi/message/batch.h index c2bb8b816b8..85e7a8df9ee 100644 --- a/storageapi/src/vespa/storageapi/message/batch.h +++ b/storageapi/src/vespa/storageapi/message/batch.h @@ -156,13 +156,14 @@ public: @return Returns a list of the updates to be performed. */ const UpdateList& getUpdates() const { return _updates; }; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** Returns a bucket id suitable for routing this message. */ document::BucketId getBucketId() const override { return _bucketId; } - bool hasSingleBucketId() const override { return true; } + virtual bool hasSingleBucketId() const override { return true; } DECLARE_STORAGECOMMAND(BatchDocumentUpdateCommand, onBatchDocumentUpdate) @@ -182,12 +183,18 @@ class BatchDocumentUpdateReply : public StorageReply { std::vector<bool> _documentsNotFound; public: explicit BatchDocumentUpdateReply(const BatchDocumentUpdateCommand&); + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + const std::vector<bool>& getDocumentsNotFound() const { return _documentsNotFound; } std::vector<bool>& getDocumentsNotFound() { return _documentsNotFound; } DECLARE_STORAGEREPLY(BatchDocumentUpdateReply, onBatchDocumentUpdateReply) }; + + } } + + diff --git a/storageapi/src/vespa/storageapi/message/bucket.h b/storageapi/src/vespa/storageapi/message/bucket.h index 31948852840..c78591eca61 100644 --- a/storageapi/src/vespa/storageapi/message/bucket.h +++ b/storageapi/src/vespa/storageapi/message/bucket.h @@ -7,14 +7,14 @@ #pragma once +#include <vespa/document/base/globalid.h> +#include <vespa/vdslib/state/clusterstate.h> +#include <vespa/storageapi/defs.h> #include <vespa/storageapi/messageapi/bucketcommand.h> #include <vespa/storageapi/messageapi/bucketreply.h> #include <vespa/storageapi/messageapi/bucketinfocommand.h> #include <vespa/storageapi/messageapi/bucketinforeply.h> #include <vespa/storageapi/messageapi/maintenancecommand.h> -#include <vespa/document/base/globalid.h> -#include <vespa/vdslib/state/clusterstate.h> -#include <vespa/storageapi/defs.h> namespace document { class DocumentTypeRepo; } @@ -32,9 +32,12 @@ class CreateBucketCommand : public MaintenanceCommand { public: explicit CreateBucketCommand(const document::BucketId& id); + void setActive(bool active) { _active = active; } bool getActive() const { return _active; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGECOMMAND(CreateBucketCommand, onCreateBucket) }; @@ -47,7 +50,9 @@ public: class CreateBucketReply : public BucketInfoReply { public: explicit CreateBucketReply(const CreateBucketCommand& cmd); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(CreateBucketReply, onCreateBucketReply); }; @@ -64,7 +69,9 @@ public: const BucketInfo& getBucketInfo() const { return _info; } void setBucketInfo(const BucketInfo& info) { _info = info; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGECOMMAND(DeleteBucketCommand, onDeleteBucket) }; @@ -77,7 +84,9 @@ public: class DeleteBucketReply : public BucketInfoReply { public: explicit DeleteBucketReply(const DeleteBucketCommand& cmd); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(DeleteBucketReply, onDeleteBucketReply) }; @@ -127,10 +136,14 @@ public: const std::vector<Node>& getNodes() const { return _nodes; } Timestamp getMaxTimestamp() const { return _maxTimestamp; } const std::vector<uint16_t>& getChain() const { return _chain; } + uint32_t getClusterStateVersion() const { return _clusterStateVersion; } + void setClusterStateVersion(uint32_t version) { _clusterStateVersion = version; } void setChain(const std::vector<uint16_t>& chain) { _chain = chain; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGECOMMAND(MergeBucketCommand, onMergeBucket) }; @@ -160,7 +173,8 @@ public: Timestamp getMaxTimestamp() const { return _maxTimestamp; } const std::vector<uint16_t>& getChain() const { return _chain; } uint32_t getClusterStateVersion() const { return _clusterStateVersion; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(MergeBucketReply, onMergeBucketReply) }; @@ -184,7 +198,8 @@ public: uint16_t _hasMask; Entry(); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; bool operator==(const Entry&) const; bool operator<(const Entry& e) const { return (_timestamp < e._timestamp); } @@ -204,7 +219,7 @@ public: const std::vector<Entry>& getDiff() const { return _diff; } std::vector<Entry>& getDiff() { return _diff; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(GetBucketDiffCommand, onGetBucketDiff) }; @@ -232,7 +247,8 @@ public: Timestamp getMaxTimestamp() const { return _maxTimestamp; } const std::vector<Entry>& getDiff() const { return _diff; } std::vector<Entry>& getDiff() { return _diff; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(GetBucketDiffReply, onGetBucketDiffReply) }; @@ -258,7 +274,8 @@ public: Entry(const GetBucketDiffCommand::Entry&); bool filled() const; - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; bool operator==(const Entry&) const; }; private: @@ -279,7 +296,8 @@ public: const std::vector<Entry>& getDiff() const { return _diff; } std::vector<Entry>& getDiff() { return _diff; } uint32_t getMaxBufferSize() const { return _maxBufferSize; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(ApplyBucketDiffCommand, onApplyBucketDiff) }; @@ -308,7 +326,7 @@ public: std::vector<Entry>& getDiff() { return _diff; } uint32_t getMaxBufferSize() const { return _maxBufferSize; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(ApplyBucketDiffReply, onApplyBucketDiffReply) }; @@ -341,11 +359,13 @@ public: RequestBucketInfoCommand(uint16_t distributor, const lib::ClusterState& state); - const std::vector<document::BucketId>& getBuckets() const { return _buckets; } + const std::vector<document::BucketId>& getBuckets() const + { return _buckets; } bool hasSystemState() const { return (_state.get() != 0); } uint16_t getDistributor() const { return _distributor; } - const lib::ClusterState& getSystemState() const { return *_state; } + const lib::ClusterState& getSystemState() const + { return *_state; } const vespalib::string& getDistributionHash() const { return _distributionHash; } @@ -382,10 +402,14 @@ public: explicit RequestBucketInfoReply(const RequestBucketInfoCommand& cmd); ~RequestBucketInfoReply(); + const EntryVector & getBucketInfo() const { return _buckets; } EntryVector & getBucketInfo() { return _buckets; } + uint32_t getMemoryFootprint() const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(RequestBucketInfoReply, onRequestBucketInfoReply) }; @@ -402,11 +426,15 @@ public: */ class NotifyBucketChangeCommand : public BucketCommand { BucketInfo _info; + public: NotifyBucketChangeCommand(const document::BucketId& bucket, const BucketInfo& bucketInfo); + const BucketInfo& getBucketInfo() const { return _info; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGECOMMAND(NotifyBucketChangeCommand, onNotifyBucketChange) }; @@ -423,7 +451,9 @@ public: class NotifyBucketChangeReply : public BucketReply { public: explicit NotifyBucketChangeReply(const NotifyBucketChangeCommand& cmd); + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(NotifyBucketChangeReply, onNotifyBucketChangeReply) }; @@ -444,13 +474,16 @@ public: private: BUCKET_STATE _state; public: - SetBucketStateCommand(const document::BucketId& bucket, BUCKET_STATE state); + SetBucketStateCommand(const document::BucketId& bucket, + BUCKET_STATE state); + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + BUCKET_STATE getState() const { return _state; } + DECLARE_STORAGECOMMAND(SetBucketStateCommand, onSetBucketState) private: - - vespalib::string getSummary() const override; + virtual vespalib::string getSummary() const override; }; /** @@ -463,9 +496,12 @@ class SetBucketStateReply : public BucketInfoReply { public: explicit SetBucketStateReply(const SetBucketStateCommand&); + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(SetBucketStateReply, onSetBucketStateReply) }; } // api } // storage + diff --git a/storageapi/src/vespa/storageapi/message/bucketsplitting.h b/storageapi/src/vespa/storageapi/message/bucketsplitting.h index 4e7c9397716..6188a7cc44f 100644 --- a/storageapi/src/vespa/storageapi/message/bucketsplitting.h +++ b/storageapi/src/vespa/storageapi/message/bucketsplitting.h @@ -57,7 +57,7 @@ public: void setMinByteSize(uint32_t v) { _minByteSize = v; } void setMinDocCount(uint32_t v) { _minDocCount = v; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(SplitBucketCommand, onSplitBucket) }; @@ -71,14 +71,19 @@ public: class SplitBucketReply : public BucketReply { public: typedef std::pair<document::BucketId, BucketInfo> Entry; + +private: + std::vector<Entry> _result; + +public: explicit SplitBucketReply(const SplitBucketCommand& cmd); + std::vector<Entry>& getSplitInfo() { return _result; } const std::vector<Entry>& getSplitInfo() const { return _result; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(SplitBucketReply, onSplitBucketReply) -private: - std::vector<Entry> _result; }; /** @@ -92,13 +97,19 @@ private: class JoinBucketsCommand : public MaintenanceCommand { std::vector<document::BucketId> _sources; uint8_t _minJoinBits; + public: explicit JoinBucketsCommand(const document::BucketId& target); + std::vector<document::BucketId>& getSourceBuckets() { return _sources; } - const std::vector<document::BucketId>& getSourceBuckets() const { return _sources; } + const std::vector<document::BucketId>& getSourceBuckets() const + { return _sources; } + void setMinJoinBits(uint8_t minJoinBits) { _minJoinBits = minJoinBits; } uint8_t getMinJoinBits() const { return _minJoinBits; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGECOMMAND(JoinBucketsCommand, onJoinBuckets) }; @@ -110,13 +121,20 @@ public: */ class JoinBucketsReply : public BucketInfoReply { std::vector<document::BucketId> _sources; + public: explicit JoinBucketsReply(const JoinBucketsCommand& cmd); + JoinBucketsReply(const JoinBucketsCommand& cmd, const BucketInfo& bucketInfo); - const std::vector<document::BucketId>& getSourceBuckets() const { return _sources; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + const std::vector<document::BucketId>& getSourceBuckets() const + { return _sources; } + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(JoinBucketsReply, onJoinBucketsReply) }; } // api } // storage + diff --git a/storageapi/src/vespa/storageapi/message/datagram.h b/storageapi/src/vespa/storageapi/message/datagram.h index 642caa8e12a..040f925f98a 100644 --- a/storageapi/src/vespa/storageapi/message/datagram.h +++ b/storageapi/src/vespa/storageapi/message/datagram.h @@ -1,11 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "visitor.h" +#include <vespa/document/bucket/bucketid.h> +#include <vespa/vdslib/container/documentlist.h> #include <vespa/storageapi/messageapi/storagecommand.h> #include <vespa/storageapi/messageapi/storagereply.h> #include <vespa/storageapi/defs.h> -#include <vespa/vdslib/container/documentlist.h> +#include <vespa/storageapi/message/visitor.h> namespace storage { namespace api { @@ -32,11 +33,16 @@ public: { assert(_docBlock.getBufferSize() > 0); return _docBlock; } const vdslib::DocumentList& getDocumentBlock() const { assert(_docBlock.getBufferSize() > 0); return _docBlock; } - void setDocumentBlock(vdslib::DocumentList& block) { _docBlock = block; } + + void setDocumentBlock(vdslib::DocumentList& block) { + _docBlock = block; + } document::BucketId getBucketId() const override { return _bucketId; } - bool hasSingleBucketId() const override { return true; } + virtual 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; } @@ -52,7 +58,9 @@ public: 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) }; @@ -68,11 +76,15 @@ public: */ class MapVisitorCommand : public StorageCommand { vdslib::Parameters _statistics; + public: MapVisitorCommand(); + vdslib::Parameters& getData() { return _statistics; }; const vdslib::Parameters& getData() const { return _statistics; }; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGECOMMAND(MapVisitorCommand, onMapVisitor) }; @@ -85,7 +97,9 @@ public: class MapVisitorReply : public StorageReply { public: explicit MapVisitorReply(const MapVisitorCommand&); + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(MapVisitorReply, onMapVisitorReply) }; @@ -106,6 +120,7 @@ public: bool _removeEntry; Entry() : _doc(), _lastModified(0), _removeEntry(false) {} + Entry(const document::Document::SP& doc, int64_t lastModified, bool removeEntry) : _doc(doc), @@ -117,13 +132,18 @@ public: private: document::BucketId _bucketId; std::vector<Entry> _documents; + public: DocumentListCommand(const document::BucketId& bid); + const document::BucketId& getBucketId() { return _bucketId; } std::vector<Entry>& getDocuments() { return _documents; } const std::vector<Entry>& getDocuments() const { return _documents; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGECOMMAND(DocumentListCommand, onDocumentList) + }; std::ostream& operator<<(std::ostream& out, const DocumentListCommand::Entry& e); @@ -137,7 +157,9 @@ std::ostream& operator<<(std::ostream& out, const DocumentListCommand::Entry& e) class DocumentListReply : public StorageReply { public: explicit DocumentListReply(const DocumentListCommand&); + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(DocumentListReply, onDocumentListReply) }; @@ -154,11 +176,18 @@ public: */ class EmptyBucketsCommand : public StorageCommand { std::vector<document::BucketId> _buckets; + public: EmptyBucketsCommand(const std::vector<document::BucketId>&); - const std::vector<document::BucketId>& getBuckets() const { return _buckets; } + + const std::vector<document::BucketId>& getBuckets() const + { return _buckets; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGECOMMAND(EmptyBucketsCommand, onEmptyBuckets) + +private: }; /** @@ -170,9 +199,12 @@ public: class EmptyBucketsReply : public StorageReply { public: explicit EmptyBucketsReply(const EmptyBucketsCommand&); + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(EmptyBucketsReply, onEmptyBucketsReply) }; } // api } // storage + diff --git a/storageapi/src/vespa/storageapi/message/documentsummary.h b/storageapi/src/vespa/storageapi/message/documentsummary.h index d9f943afc07..b32723c6ddb 100644 --- a/storageapi/src/vespa/storageapi/message/documentsummary.h +++ b/storageapi/src/vespa/storageapi/message/documentsummary.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "visitor.h" #include <vespa/vdslib/container/documentsummary.h> +#include <vespa/storageapi/message/visitor.h> namespace storage { namespace api { @@ -18,10 +18,13 @@ class DocumentSummaryCommand : public StorageCommand, { public: explicit DocumentSummaryCommand(); + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + uint32_t getMemoryFootprint() const override { return getSerializedSize(); } + DECLARE_STORAGECOMMAND(DocumentSummaryCommand, onDocumentSummary) }; @@ -34,9 +37,12 @@ public: class DocumentSummaryReply : public StorageReply { public: explicit DocumentSummaryReply(const DocumentSummaryCommand& command); + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(DocumentSummaryReply, onDocumentSummaryReply) }; } // api } // storage + diff --git a/storageapi/src/vespa/storageapi/message/persistence.h b/storageapi/src/vespa/storageapi/message/persistence.h index 251750eed60..470acca566b 100644 --- a/storageapi/src/vespa/storageapi/message/persistence.h +++ b/storageapi/src/vespa/storageapi/message/persistence.h @@ -67,9 +67,12 @@ public: uint32_t getMemoryFootprint() const override { return (_doc.get() ? 4096 : 0) + 20; } + vespalib::string getSummary() const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; + + virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(PutCommand, onPut); }; @@ -137,7 +140,8 @@ public: vespalib::string getSummary() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; + + virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(UpdateCommand, onUpdate); }; @@ -199,7 +203,9 @@ public: GetCommand(const document::BucketId&, const document::DocumentId&, const vespalib::stringref & fieldSet, Timestamp before = MAX_TIMESTAMP); ~GetCommand(); + void setBeforeTimestamp(Timestamp ts) { _beforeTimestamp = ts; } + const document::DocumentId& getDocumentId() const { return _docId; } Timestamp getBeforeTimestamp() const { return _beforeTimestamp; } const vespalib::string& getFieldSet() const { return _fieldSet; } @@ -208,7 +214,7 @@ public: vespalib::string getSummary() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; + virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(GetCommand, onGet) }; @@ -240,10 +246,13 @@ public: Timestamp getBeforeTimestamp() const { return _beforeTimestamp; } bool wasFound() const { return (_doc.get() != 0); } + uint32_t getMemoryFootprint() const override { return (_doc.get() ? 4096 : 0) + 30; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(GetReply, onGetReply) }; @@ -258,15 +267,20 @@ class RemoveCommand : public TestAndSetCommand { Timestamp _timestamp; public: - RemoveCommand(const document::BucketId&, const document::DocumentId& docId, Timestamp timestamp); + RemoveCommand(const document::BucketId&, const document::DocumentId& docId, + Timestamp timestamp); ~RemoveCommand(); void setTimestamp(Timestamp ts) { _timestamp = ts; } + const document::DocumentId& getDocumentId() const override { return _docId; } Timestamp getTimestamp() const { return _timestamp; } + vespalib::string getSummary() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; + + virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; + DECLARE_STORAGECOMMAND(RemoveCommand, onRemove) }; @@ -280,6 +294,7 @@ class RemoveReply : public BucketInfoReply { document::DocumentId _docId; Timestamp _timestamp; Timestamp _oldTimestamp; + public: explicit RemoveReply(const RemoveCommand& cmd, Timestamp oldTimestamp = 0); ~RemoveReply(); @@ -287,9 +302,13 @@ public: const document::DocumentId& getDocumentId() const { return _docId; } Timestamp getTimestamp() { return _timestamp; }; Timestamp getOldTimestamp() const { return _oldTimestamp; } + void setOldTimestamp(Timestamp oldTimestamp) { _oldTimestamp = oldTimestamp; } + bool wasFound() const { return (_oldTimestamp != 0); } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(RemoveReply, onRemoveReply) }; @@ -301,12 +320,16 @@ public: */ class RevertCommand : public BucketInfoCommand { std::vector<Timestamp> _tokens; + public: RevertCommand(const document::BucketId& bucket, const std::vector<Timestamp>& revertTokens); ~RevertCommand(); + const std::vector<Timestamp>& getRevertTokens() const { return _tokens; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGECOMMAND(RevertCommand, onRevert) }; @@ -318,13 +341,19 @@ public: */ class RevertReply : public BucketInfoReply { std::vector<Timestamp> _tokens; + public: explicit RevertReply(const RevertCommand& cmd); ~RevertReply(); + const std::vector<Timestamp>& getRevertTokens() const { return _tokens; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(RevertReply, onRevertReply) }; } // api } // storage + + diff --git a/storageapi/src/vespa/storageapi/message/queryresult.h b/storageapi/src/vespa/storageapi/message/queryresult.h index 282a45ee43b..8020fa22dea 100644 --- a/storageapi/src/vespa/storageapi/message/queryresult.h +++ b/storageapi/src/vespa/storageapi/message/queryresult.h @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "visitor.h" #include <vespa/vdslib/container/searchresult.h> #include <vespa/vdslib/container/documentsummary.h> +#include <vespa/storageapi/message/visitor.h> namespace storage { namespace api { @@ -43,9 +43,12 @@ private: class QueryResultReply : public StorageReply { public: explicit QueryResultReply(const QueryResultCommand& command); + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(QueryResultReply, onQueryResultReply) }; } // api } // storage + diff --git a/storageapi/src/vespa/storageapi/message/removelocation.h b/storageapi/src/vespa/storageapi/message/removelocation.h index 6232ddece90..08b5663e2d6 100644 --- a/storageapi/src/vespa/storageapi/message/removelocation.h +++ b/storageapi/src/vespa/storageapi/message/removelocation.h @@ -5,6 +5,7 @@ #include <vespa/storageapi/messageapi/storagecommand.h> #include <vespa/storageapi/messageapi/bucketinforeply.h> + namespace storage { namespace api { @@ -14,12 +15,17 @@ public: RemoveLocationCommand(const vespalib::stringref & documentSelection, const document::BucketId&); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, + const std::string& indent) const override; + uint32_t getMemoryFootprint() const override { return _documentSelection.length(); } + const vespalib::string& getDocumentSelection() const { return _documentSelection; } + DECLARE_STORAGECOMMAND(RemoveLocationCommand, onRemoveLocation); + private: vespalib::string _documentSelection; }; @@ -28,8 +34,10 @@ class RemoveLocationReply : public BucketInfoReply { public: RemoveLocationReply(const RemoveLocationCommand& cmd); + DECLARE_STORAGEREPLY(RemoveLocationReply, onRemoveLocationReply) }; } } + diff --git a/storageapi/src/vespa/storageapi/message/searchresult.h b/storageapi/src/vespa/storageapi/message/searchresult.h index 220f48a5973..b2662800a9d 100644 --- a/storageapi/src/vespa/storageapi/message/searchresult.h +++ b/storageapi/src/vespa/storageapi/message/searchresult.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "visitor.h" #include <vespa/vdslib/container/searchresult.h> +#include <vespa/storageapi/message/visitor.h> namespace storage { namespace api { @@ -16,8 +16,13 @@ namespace api { class SearchResultCommand : public StorageCommand, public vdslib::SearchResult { public: SearchResultCommand(); + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - uint32_t getMemoryFootprint() const override { return getSerializedSize(); } + + uint32_t getMemoryFootprint() const override { + return getSerializedSize(); + } + DECLARE_STORAGECOMMAND(SearchResultCommand, onSearchResult) }; @@ -30,9 +35,12 @@ public: class SearchResultReply : public StorageReply { public: explicit SearchResultReply(const SearchResultCommand& command); + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(SearchResultReply, onSearchResultReply) }; } // api } // storage + diff --git a/storageapi/src/vespa/storageapi/message/stat.h b/storageapi/src/vespa/storageapi/message/stat.h index 071f3e8ebdd..3ee4afbb4ba 100644 --- a/storageapi/src/vespa/storageapi/message/stat.h +++ b/storageapi/src/vespa/storageapi/message/stat.h @@ -20,22 +20,30 @@ namespace api { class StatBucketCommand : public BucketCommand { private: vespalib::string _docSelection; + public: StatBucketCommand(const document::BucketId& bucket, const vespalib::stringref & documentSelection); const vespalib::string& getDocumentSelection() const { return _docSelection; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - StorageCommand::UP createCopyToForward(const document::BucketId&, uint64_t timestamp) const override; + + virtual StorageCommand::UP createCopyToForward(const document::BucketId&, uint64_t timestamp) const override; + DECLARE_STORAGECOMMAND(StatBucketCommand, onStatBucket); }; class StatBucketReply : public BucketReply { vespalib::string _results; + public: StatBucketReply(const StatBucketCommand&, const vespalib::stringref & results = ""); + const vespalib::string& getResults() { return _results; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(StatBucketReply, onStatBucketReply) }; @@ -52,7 +60,9 @@ public: class GetBucketListCommand : public BucketCommand { public: GetBucketListCommand(const document::BucketId& bucket); + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGECOMMAND(GetBucketListCommand, onGetBucketList); }; @@ -66,7 +76,8 @@ public: const vespalib::stringref & bucketInformation) : _bucket(id), _bucketInformation(bucketInformation) - {} + { + } bool operator==(const BucketInfo& other) const { return (_bucket == other._bucket @@ -79,9 +90,12 @@ private: public: GetBucketListReply(const GetBucketListCommand&); + std::vector<BucketInfo>& getBuckets() { return _buckets; } const std::vector<BucketInfo>& getBuckets() const { return _buckets; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + DECLARE_STORAGEREPLY(GetBucketListReply, onGetBucketListReply) }; @@ -90,3 +104,4 @@ std::ostream& operator<<(std::ostream& out, const GetBucketListReply::BucketInfo } // api } // storage + diff --git a/storageapi/src/vespa/storageapi/message/state.h b/storageapi/src/vespa/storageapi/message/state.h index 86830f86e7b..12a357c1b40 100644 --- a/storageapi/src/vespa/storageapi/message/state.h +++ b/storageapi/src/vespa/storageapi/message/state.h @@ -1,5 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - +/** + * @file state.h + * + * State commands. + */ #pragma once #include <vespa/storageapi/messageapi/storagecommand.h> @@ -21,7 +25,9 @@ class GetNodeStateCommand : public StorageCommand { public: explicit GetNodeStateCommand(lib::NodeState::UP expectedState); - const lib::NodeState* getExpectedState() const { return _expectedState.get(); } + const lib::NodeState* getExpectedState() const + { return _expectedState.get(); } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(GetNodeStateCommand, onGetNodeState) @@ -65,7 +71,9 @@ class SetSystemStateCommand : public StorageCommand { public: explicit SetSystemStateCommand(const lib::ClusterState&); + const lib::ClusterState& getSystemState() const { return _state; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(SetSystemStateCommand, onSetSystemState) @@ -85,6 +93,7 @@ public: // Not serialized. Available locally const lib::ClusterState& getSystemState() const { return _state; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(SetSystemStateReply, onSetSystemStateReply) @@ -92,3 +101,4 @@ public: } // api } // storage + diff --git a/storageapi/src/vespa/storageapi/message/visitor.h b/storageapi/src/vespa/storageapi/message/visitor.h index c1d0bb637a0..a9d1de402da 100644 --- a/storageapi/src/vespa/storageapi/message/visitor.h +++ b/storageapi/src/vespa/storageapi/message/visitor.h @@ -108,11 +108,14 @@ public: void setVisitorOrdering(document::OrderingSpecification::Order ordering) { _ordering = ordering; } document::OrderingSpecification::Order getVisitorOrdering() const { return _ordering; } - void setMaxBucketsPerVisitor(uint32_t max) { _maxBucketsPerVisitor = max; } - uint32_t getMaxBucketsPerVisitor() const { return _maxBucketsPerVisitor; } + void setMaxBucketsPerVisitor(uint32_t max) + { _maxBucketsPerVisitor = max; } + uint32_t getMaxBucketsPerVisitor() const + { return _maxBucketsPerVisitor; } void print(std::ostream& out, bool verbose, const std::string& indent) const override; - StorageCommand::UP createCopyToForward(const document::BucketId&, uint64_t timestamp) const override; + + virtual StorageCommand::UP createCopyToForward(const document::BucketId&, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(CreateVisitorCommand, onCreateVisitor) }; diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h b/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h index 95b2284661a..7c078b9545a 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h @@ -8,7 +8,8 @@ #pragma once -#include "storagecommand.h" +#include <vespa/document/bucket/bucketid.h> +#include <vespa/storageapi/messageapi/storagecommand.h> namespace storage { namespace api { @@ -31,9 +32,13 @@ public: document::BucketId getBucketId() const override { return _bucket; } bool hasBeenRemapped() const { return (_originalBucket.getRawId() != 0); } - const document::BucketId& getOriginalBucketId() const { return _originalBucket; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - bool hasSingleBucketId() const override { return true; } + const document::BucketId& getOriginalBucketId() const + { return _originalBucket; } + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + virtual bool hasSingleBucketId() const override { return true; } + }; } // api diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h b/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h index d9d924bc338..62171a9e3c0 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h @@ -12,7 +12,7 @@ #pragma once -#include "bucketcommand.h" +#include <vespa/storageapi/messageapi/bucketcommand.h> namespace storage { namespace api { @@ -24,7 +24,8 @@ protected: public: DECLARE_POINTER_TYPEDEFS(BucketInfoCommand); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h b/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h index d5b174e4f2e..d39a6a5eaf8 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h @@ -12,9 +12,9 @@ #pragma once -#include "bucketreply.h" -#include "bucketinfocommand.h" #include <vespa/storageapi/buckets/bucketinfo.h> +#include <vespa/storageapi/messageapi/bucketreply.h> +#include <vespa/storageapi/messageapi/bucketinfocommand.h> namespace storage { namespace api { @@ -31,8 +31,11 @@ public: const BucketInfo& getBucketInfo() const { return _result; }; void setBucketInfo(const BucketInfo& info) { _result = info; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + /** Overload this to get more descriptive message output. */ + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api } // storage + diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketreply.h b/storageapi/src/vespa/storageapi/messageapi/bucketreply.h index 0cd2c2065fe..833f1396c49 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketreply.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketreply.h @@ -8,7 +8,8 @@ #pragma once -#include "storagereply.h" +#include <vespa/document/bucket/bucketid.h> +#include <vespa/storageapi/messageapi/storagereply.h> namespace storage { namespace api { @@ -38,8 +39,10 @@ public: if (_originalBucket.getRawId() == 0) _originalBucket = _bucket; _bucket = bucket; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api } // storage + diff --git a/storageapi/src/vespa/storageapi/messageapi/messagehandler.h b/storageapi/src/vespa/storageapi/messageapi/messagehandler.h index 131ee8d2400..66873dfba27 100644 --- a/storageapi/src/vespa/storageapi/messageapi/messagehandler.h +++ b/storageapi/src/vespa/storageapi/messageapi/messagehandler.h @@ -13,7 +13,6 @@ #pragma once -#include <memory> namespace storage { namespace api { diff --git a/storageapi/src/vespa/storageapi/messageapi/returncode.cpp b/storageapi/src/vespa/storageapi/messageapi/returncode.cpp index e2d10487431..f11d91b7079 100644 --- a/storageapi/src/vespa/storageapi/messageapi/returncode.cpp +++ b/storageapi/src/vespa/storageapi/messageapi/returncode.cpp @@ -1,6 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "returncode.h" +#include <vespa/messagebus/errorcode.h> + +#include <vespa/document/util/bytebuffer.h> +#include <vespa/fnet/frt/error.h> #include <ostream> namespace storage { diff --git a/storageapi/src/vespa/storageapi/messageapi/returncode.h b/storageapi/src/vespa/storageapi/messageapi/returncode.h index 0aa87c64012..a7be570e8f4 100644 --- a/storageapi/src/vespa/storageapi/messageapi/returncode.h +++ b/storageapi/src/vespa/storageapi/messageapi/returncode.h @@ -14,6 +14,7 @@ #include <vespa/document/util/serializable.h> #include <vespa/documentapi/messagebus/documentprotocol.h> #include <iosfwd> +#include <string> namespace document { class ByteBuffer; @@ -67,7 +68,9 @@ public: private: Result _result; vespalib::string _message; - void onDeserialize(const document::DocumentTypeRepo &repo, document::ByteBuffer& buffer) override; + + void onDeserialize(const document::DocumentTypeRepo &repo, + document::ByteBuffer& buffer) override; void onSerialize(document::ByteBuffer& buffer) const override; public: @@ -120,3 +123,4 @@ public: } // api } // storage + diff --git a/storageapi/src/vespa/storageapi/messageapi/storagecommand.h b/storageapi/src/vespa/storageapi/messageapi/storagecommand.h index d67cbcf2bcb..00f17458e6a 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagecommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/storagecommand.h @@ -12,7 +12,7 @@ #pragma once -#include "storagemessage.h" +#include <vespa/storageapi/messageapi/storagemessage.h> namespace storage { namespace api { @@ -46,7 +46,7 @@ public: void setNewId() { StorageMessage::setNewMsgId(); } /** Overload this to get more descriptive message output. */ - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** * A way for someone to make a reply to a storage message without diff --git a/storageapi/src/vespa/storageapi/messageapi/storagemessage.h b/storageapi/src/vespa/storageapi/messageapi/storagemessage.h index 8801916c14b..47dd93a9535 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagemessage.h +++ b/storageapi/src/vespa/storageapi/messageapi/storagemessage.h @@ -11,11 +11,11 @@ #pragma once -#include "messagehandler.h" #include <map> #include <vespa/vespalib/util/printable.h> #include <vespa/messagebus/routing/route.h> #include <vespa/vespalib/util/sync.h> +#include <vespa/storageapi/messageapi/messagehandler.h> #include <vespa/vdslib/state/nodetype.h> #include <vespa/messagebus/trace.h> #include <vespa/documentapi/loadtypes/loadtype.h> @@ -42,8 +42,9 @@ namespace vespalib { public: \ DECLARE_POINTER_TYPEDEFS(reply) \ private: \ - bool callHandler(MessageHandler& h, \ - const std::shared_ptr<StorageMessage>& m) const override \ + virtual bool callHandler( \ + MessageHandler& h, \ + const std::shared_ptr<StorageMessage>& m) const override \ { \ return h.callback(std::static_pointer_cast<reply>(m)); \ } @@ -65,7 +66,7 @@ public: \ #define IMPLEMENT_COMMAND(command, reply) \ IMPLEMENT_COMMON(command) \ std::unique_ptr<storage::api::StorageReply> \ - storage::api::command::makeReply() \ + storage::api::command::makeReply() \ { \ return std::unique_ptr<storage::api::StorageReply>(new reply(*this)); \ } diff --git a/storageapi/src/vespa/storageapi/messageapi/storagereply.h b/storageapi/src/vespa/storageapi/messageapi/storagereply.h index 4d185ea7a29..eab6470f463 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagereply.h +++ b/storageapi/src/vespa/storageapi/messageapi/storagereply.h @@ -12,8 +12,8 @@ #pragma once -#include "returncode.h" -#include "storagemessage.h" +#include <vespa/storageapi/messageapi/returncode.h> +#include <vespa/storageapi/messageapi/storagemessage.h> namespace storage { namespace api { @@ -34,7 +34,9 @@ public: void setResult(const ReturnCode& r) { _result = r; } void setResult(ReturnCode::Result r) { _result = ReturnCode(r); } const ReturnCode& getResult() const { return _result; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + + /** Overload this to get more descriptive output. */ + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api |