diff options
Diffstat (limited to 'messagebus')
39 files changed, 156 insertions, 60 deletions
diff --git a/messagebus/src/tests/context/context.cpp b/messagebus/src/tests/context/context.cpp index 3ba19e8f858..5ad36df7c72 100644 --- a/messagebus/src/tests/context/context.cpp +++ b/messagebus/src/tests/context/context.cpp @@ -27,7 +27,7 @@ struct Handler : public IMessageHandler ~Handler() { session.reset(); } - void handleMessage(Message::UP msg) override { + virtual void handleMessage(Message::UP msg) override { session->acknowledge(std::move(msg)); } }; diff --git a/messagebus/src/tests/loadbalance/loadbalance.cpp b/messagebus/src/tests/loadbalance/loadbalance.cpp index 9e2a6e48d24..83ff4c042da 100644 --- a/messagebus/src/tests/loadbalance/loadbalance.cpp +++ b/messagebus/src/tests/loadbalance/loadbalance.cpp @@ -28,7 +28,7 @@ struct Handler : public IMessageHandler ~Handler() { session.reset(); } - void handleMessage(Message::UP msg) override { + virtual void handleMessage(Message::UP msg) override { ++cnt; session->acknowledge(std::move(msg)); } diff --git a/messagebus/src/tests/messageordering/messageordering.cpp b/messagebus/src/tests/messageordering/messageordering.cpp index df6ca38dd0d..e80505b2e89 100644 --- a/messagebus/src/tests/messageordering/messageordering.cpp +++ b/messagebus/src/tests/messageordering/messageordering.cpp @@ -46,8 +46,8 @@ public: _destinationSession(0), _messageCounter(0) {} - void handleMessage(Message::UP msg) override - { + virtual void handleMessage(Message::UP msg) override + { SimpleMessage& simpleMsg(dynamic_cast<SimpleMessage&>(*msg)); LOG(spam, "Attempting to acquire lock for %s", simpleMsg.getValue().c_str()); diff --git a/messagebus/src/tests/messenger/messenger.cpp b/messagebus/src/tests/messenger/messenger.cpp index 7b2b75212ee..5cf3625523f 100644 --- a/messagebus/src/tests/messenger/messenger.cpp +++ b/messagebus/src/tests/messenger/messenger.cpp @@ -1,4 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("messagebus_test"); #include <vespa/messagebus/messenger.h> #include <vespa/vespalib/util/barrier.h> diff --git a/messagebus/src/tests/oos/oos.cpp b/messagebus/src/tests/oos/oos.cpp index dc224a1519c..b19de4a94f8 100644 --- a/messagebus/src/tests/oos/oos.cpp +++ b/messagebus/src/tests/oos/oos.cpp @@ -1,4 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("oos_test"); #include <vespa/messagebus/destinationsession.h> #include <vespa/messagebus/errorcode.h> @@ -28,7 +31,7 @@ struct Handler : public IMessageHandler ~Handler() { session.reset(); } - void handleMessage(Message::UP msg) override { + virtual void handleMessage(Message::UP msg) override { session->acknowledge(std::move(msg)); } }; diff --git a/messagebus/src/tests/protocolrepository/protocolrepository.cpp b/messagebus/src/tests/protocolrepository/protocolrepository.cpp index f9c971336c5..cf1d77bdc7e 100644 --- a/messagebus/src/tests/protocolrepository/protocolrepository.cpp +++ b/messagebus/src/tests/protocolrepository/protocolrepository.cpp @@ -1,4 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("protocolrepository_test"); #include <vespa/messagebus/protocolrepository.h> #include <vespa/vespalib/testkit/testapp.h> diff --git a/messagebus/src/tests/replygate/replygate.cpp b/messagebus/src/tests/replygate/replygate.cpp index 8f784495866..d190f278be4 100644 --- a/messagebus/src/tests/replygate/replygate.cpp +++ b/messagebus/src/tests/replygate/replygate.cpp @@ -1,4 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("replygate_test"); #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/imessagehandler.h> @@ -41,7 +44,7 @@ struct MySender : public IMessageHandler { // giving a sync reply here is against the API contract, but it is // ok for testing. - void handleMessage(Message::UP msg) override { + virtual void handleMessage(Message::UP msg) override { Reply::UP reply(new MyReply()); msg->swapState(*reply); IReplyHandler &handler = reply->getCallStack().pop(*reply); diff --git a/messagebus/src/tests/resender/resender.cpp b/messagebus/src/tests/resender/resender.cpp index 701ce20737c..dad8ef73e68 100644 --- a/messagebus/src/tests/resender/resender.cpp +++ b/messagebus/src/tests/resender/resender.cpp @@ -1,4 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("routing_test"); #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/errorcode.h> diff --git a/messagebus/src/tests/result/result.cpp b/messagebus/src/tests/result/result.cpp index 963e44d1dda..a404135d64c 100644 --- a/messagebus/src/tests/result/result.cpp +++ b/messagebus/src/tests/result/result.cpp @@ -1,5 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("result_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/messagebus/result.h> #include <vespa/messagebus/error.h> diff --git a/messagebus/src/tests/routablequeue/routablequeue.cpp b/messagebus/src/tests/routablequeue/routablequeue.cpp index 3f014236440..a6bd66bd5df 100644 --- a/messagebus/src/tests/routablequeue/routablequeue.cpp +++ b/messagebus/src/tests/routablequeue/routablequeue.cpp @@ -1,4 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("routablequeue_test"); #include <vespa/messagebus/routablequeue.h> #include <vespa/messagebus/testlib/simplemessage.h> @@ -13,8 +16,8 @@ private: static uint32_t _cnt; public: TestMessage(uint32_t id) : SimpleMessage(""), _id(id) { ++_cnt; } - ~TestMessage() { --_cnt; } - uint32_t getType() const override { return _id; } + virtual ~TestMessage() { --_cnt; } + virtual uint32_t getType() const override { return _id; } static uint32_t getCnt() { return _cnt; } }; uint32_t TestMessage::_cnt = 0; @@ -25,8 +28,8 @@ private: static uint32_t _cnt; public: TestReply(uint32_t id) : SimpleReply(""), _id(id) { ++_cnt; } - ~TestReply() { --_cnt; } - uint32_t getType() const override { return _id; } + virtual ~TestReply() { --_cnt; } + virtual uint32_t getType() const override { return _id; } static uint32_t getCnt() { return _cnt; } }; uint32_t TestReply::_cnt = 0; diff --git a/messagebus/src/tests/routeparser/routeparser.cpp b/messagebus/src/tests/routeparser/routeparser.cpp index fc000fe571b..a00cea825ba 100644 --- a/messagebus/src/tests/routeparser/routeparser.cpp +++ b/messagebus/src/tests/routeparser/routeparser.cpp @@ -1,4 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("routeparser_test"); #include <vespa/messagebus/errorcode.h> #include <vespa/messagebus/routing/errordirective.h> @@ -13,9 +16,6 @@ #include <vespa/messagebus/testlib/testserver.h> #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/log/log.h> -LOG_SETUP("routeparser_test"); - using namespace mbus; class Test : public vespalib::TestApp { diff --git a/messagebus/src/tests/routing/routing.cpp b/messagebus/src/tests/routing/routing.cpp index 8fd2c3951e4..506d003a8b7 100644 --- a/messagebus/src/tests/routing/routing.cpp +++ b/messagebus/src/tests/routing/routing.cpp @@ -1,4 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/errorcode.h> #include <vespa/messagebus/messagebus.h> @@ -14,8 +15,8 @@ #include <vespa/messagebus/testlib/testserver.h> #include <vespa/vespalib/component/vtag.h> #include <vespa/vespalib/testkit/testapp.h> - #include <vespa/log/log.h> + LOG_SETUP("routing_test"); using namespace mbus; @@ -413,9 +414,12 @@ private: public: MyPolicy(const MyPolicyFactory &parent) : _parent(parent) - {} + { + // empty + } - void select(RoutingContext &ctx) override + virtual void + select(RoutingContext &ctx) override { if (!_parent._selectRoute.empty()) { ctx.addChild(Route::parse(_parent._selectRoute)); @@ -429,8 +433,9 @@ public: throw TestException(); } } - - void merge(RoutingContext &ctx) override + + virtual void + merge(RoutingContext &ctx) override { if (_parent._mergeError != ErrorCode::NONE) { Reply::UP reply(new EmptyReply()); diff --git a/messagebus/src/tests/routingcontext/routingcontext.cpp b/messagebus/src/tests/routingcontext/routingcontext.cpp index 281cf782a6b..6ee62b4d697 100644 --- a/messagebus/src/tests/routingcontext/routingcontext.cpp +++ b/messagebus/src/tests/routingcontext/routingcontext.cpp @@ -1,4 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("routingcontext_test"); #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/errorcode.h> diff --git a/messagebus/src/tests/sendadapter/sendadapter.cpp b/messagebus/src/tests/sendadapter/sendadapter.cpp index 5ab1e57f0d4..bcac60d800a 100644 --- a/messagebus/src/tests/sendadapter/sendadapter.cpp +++ b/messagebus/src/tests/sendadapter/sendadapter.cpp @@ -1,4 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("sendadapter_test"); #include <vespa/messagebus/messagebus.h> #include <vespa/messagebus/testlib/receptor.h> @@ -9,9 +12,6 @@ #include <vespa/messagebus/testlib/testserver.h> #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/log/log.h> -LOG_SETUP("sendadapter_test"); - using namespace mbus; //////////////////////////////////////////////////////////////////////////////// diff --git a/messagebus/src/tests/serviceaddress/serviceaddress.cpp b/messagebus/src/tests/serviceaddress/serviceaddress.cpp index ea6261f0169..ec2d1374e9b 100644 --- a/messagebus/src/tests/serviceaddress/serviceaddress.cpp +++ b/messagebus/src/tests/serviceaddress/serviceaddress.cpp @@ -1,12 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("serviceaddress_test"); #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/messagebus/testlib/slobrok.h> -#include <vespa/messagebus/testlib/testserver.h> -#include <vespa/messagebus/testlib/receptor.h> -#include <vespa/messagebus/testlib/simplemessage.h> -#include <vespa/messagebus/testlib/simplereply.h> -#include <vespa/messagebus/testlib/simpleprotocol.h> +#include <vespa/vespalib/util/vstringfmt.h> #include <vespa/messagebus/messagebus.h> #include <vespa/messagebus/sourcesession.h> #include <vespa/messagebus/intermediatesession.h> @@ -17,7 +15,12 @@ #include <vespa/messagebus/routing/routingspec.h> #include <vespa/messagebus/network/rpcservice.h> #include <vespa/messagebus/sourcesessionparams.h> -#include <vespa/vespalib/util/vstringfmt.h> +#include <vespa/messagebus/testlib/slobrok.h> +#include <vespa/messagebus/testlib/testserver.h> +#include <vespa/messagebus/testlib/receptor.h> +#include <vespa/messagebus/testlib/simplemessage.h> +#include <vespa/messagebus/testlib/simplereply.h> +#include <vespa/messagebus/testlib/simpleprotocol.h> using namespace mbus; diff --git a/messagebus/src/tests/servicepool/servicepool.cpp b/messagebus/src/tests/servicepool/servicepool.cpp index 76c366930d9..8601cfa8fee 100644 --- a/messagebus/src/tests/servicepool/servicepool.cpp +++ b/messagebus/src/tests/servicepool/servicepool.cpp @@ -1,4 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("servicepool_test"); #include <vespa/messagebus/network/rpcnetwork.h> #include <vespa/messagebus/testlib/slobrok.h> diff --git a/messagebus/src/tests/shutdown/shutdown.cpp b/messagebus/src/tests/shutdown/shutdown.cpp index 1f6944adb9e..5f5fe847f57 100644 --- a/messagebus/src/tests/shutdown/shutdown.cpp +++ b/messagebus/src/tests/shutdown/shutdown.cpp @@ -1,4 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("shutdown_test"); #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/errorcode.h> diff --git a/messagebus/src/tests/sourcesession/sourcesession.cpp b/messagebus/src/tests/sourcesession/sourcesession.cpp index a7fde7f28e0..24d99f5d44f 100644 --- a/messagebus/src/tests/sourcesession/sourcesession.cpp +++ b/messagebus/src/tests/sourcesession/sourcesession.cpp @@ -1,4 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("sourcesession_test"); #include <vespa/messagebus/destinationsession.h> #include <vespa/messagebus/error.h> @@ -31,7 +34,7 @@ struct DelayedHandler : public IMessageHandler ~DelayedHandler() { session.reset(); } - void handleMessage(Message::UP msg) override { + virtual void handleMessage(Message::UP msg) override { // this will block the transport thread in the server messagebus, // but that should be ok, as we only want to test the timing in the // client messagebus... diff --git a/messagebus/src/tests/targetpool/targetpool.cpp b/messagebus/src/tests/targetpool/targetpool.cpp index dda44765ba6..30744e74202 100644 --- a/messagebus/src/tests/targetpool/targetpool.cpp +++ b/messagebus/src/tests/targetpool/targetpool.cpp @@ -1,10 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> #include <vespa/messagebus/network/rpctargetpool.h> #include <vespa/messagebus/testlib/slobrok.h> #include <vespa/messagebus/testlib/testserver.h> #include <vespa/vespalib/testkit/testapp.h> - #include <vespa/log/log.h> + LOG_SETUP("targetpool_test"); using namespace mbus; diff --git a/messagebus/src/tests/throttling/throttling.cpp b/messagebus/src/tests/throttling/throttling.cpp index a1065c44487..acc5b2ddc4d 100644 --- a/messagebus/src/tests/throttling/throttling.cpp +++ b/messagebus/src/tests/throttling/throttling.cpp @@ -1,4 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("throttling_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/messagebus/destinationsession.h> diff --git a/messagebus/src/tests/timeout/timeout.cpp b/messagebus/src/tests/timeout/timeout.cpp index a14176cb1ef..d51ee34a08b 100644 --- a/messagebus/src/tests/timeout/timeout.cpp +++ b/messagebus/src/tests/timeout/timeout.cpp @@ -1,5 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("timeout_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/messagebus/errorcode.h> #include <vespa/messagebus/emptyreply.h> diff --git a/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp b/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp index effe461c5a8..5a9324257b5 100644 --- a/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp +++ b/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp @@ -1,5 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("simple-roundtrip_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/messagebus.h> diff --git a/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h b/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h index ff49f15b416..d552c3c48e9 100644 --- a/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h +++ b/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h @@ -164,8 +164,13 @@ public: */ uint32_t getMaxPendingCount() const { return (uint32_t)_windowSize; } + // Implements IThrottlePolicy. bool canSend(const Message &msg, uint32_t pendingCount) override; + + // Implements IThrottlePolicy. void processMessage(Message &msg) override; + + // Implements IThrottlePolicy. void processReply(Reply &reply) override; }; diff --git a/messagebus/src/vespa/messagebus/emptyreply.h b/messagebus/src/vespa/messagebus/emptyreply.h index db8beb33b9b..f2d431c8ada 100644 --- a/messagebus/src/vespa/messagebus/emptyreply.h +++ b/messagebus/src/vespa/messagebus/emptyreply.h @@ -26,23 +26,24 @@ public: * * @return "" */ - const string & getProtocol() const override; + virtual const string & getProtocol() const override; /** * This method returns the message type id reserved for empty replies: 0 * * @return 0 */ - uint32_t getType() const override; + virtual uint32_t getType() const override; /** * Encodes this reply into an empty blob. * * @return empty blob */ - Blob encode() const; + virtual Blob encode() const; uint8_t priority() const override { return 8; } }; } // namespace mbus + diff --git a/messagebus/src/vespa/messagebus/intermediatesession.h b/messagebus/src/vespa/messagebus/intermediatesession.h index b4832d5069a..064b223707f 100644 --- a/messagebus/src/vespa/messagebus/intermediatesession.h +++ b/messagebus/src/vespa/messagebus/intermediatesession.h @@ -87,7 +87,10 @@ public: */ const string getConnectionSpec() const; + // Implements IMessageHandler. void handleMessage(Message::UP message) override; + + // Implements IReplyHandler. void handleReply(Reply::UP reply) override; }; diff --git a/messagebus/src/vespa/messagebus/message.h b/messagebus/src/vespa/messagebus/message.h index cea0aaa91fb..6fc72af0055 100644 --- a/messagebus/src/vespa/messagebus/message.h +++ b/messagebus/src/vespa/messagebus/message.h @@ -35,9 +35,10 @@ public: * will log an error and generate an auto-reply to avoid having the sender * wait indefinetly for a reply. */ - ~Message(); + virtual ~Message(); - void swapState(Routable &rhs) override; + // Overrides Routable. + virtual void swapState(Routable &rhs) override; /** * Returns the timestamp for when this message was last seen by message @@ -138,7 +139,7 @@ public: * * @return false */ - bool isReply() const override { return false; } + virtual bool isReply() const override { return false; } /** * Returns whether or not this message contains a sequence identifier that diff --git a/messagebus/src/vespa/messagebus/messenger.h b/messagebus/src/vespa/messagebus/messenger.h index 70207029e19..fe76513eef9 100644 --- a/messagebus/src/vespa/messagebus/messenger.h +++ b/messagebus/src/vespa/messagebus/messenger.h @@ -47,6 +47,7 @@ private: bool _closed; protected: + // Implements FastOS_Runnable. void Run(FastOS_ThreadInterface *thread, void *arg) override; public: diff --git a/messagebus/src/vespa/messagebus/reply.h b/messagebus/src/vespa/messagebus/reply.h index f352d442931..8bc4f5921e0 100644 --- a/messagebus/src/vespa/messagebus/reply.h +++ b/messagebus/src/vespa/messagebus/reply.h @@ -39,10 +39,17 @@ public: * will log an error and generate an auto-reply to avoid having the sender * wait indefinetly for a reply. */ - ~Reply(); + virtual ~Reply(); - void swapState(Routable &rhs) override; - bool isReply() const override; + // Inherit doc from Routable. + virtual void swapState(Routable &rhs) override; + + /** + * Inherited from Routable. Classifies this object as 'a reply'. + * + * @return true + */ + virtual bool isReply() const override; /** * Add an Error to this Reply diff --git a/messagebus/src/vespa/messagebus/routablequeue.h b/messagebus/src/vespa/messagebus/routablequeue.h index acb99d7269a..ea2b14b64f6 100644 --- a/messagebus/src/vespa/messagebus/routablequeue.h +++ b/messagebus/src/vespa/messagebus/routablequeue.h @@ -76,14 +76,14 @@ public: * * @param msg the Message to handle **/ - void handleMessage(Message::UP msg) override; + virtual void handleMessage(Message::UP msg) override; /** * Handle a Reply by enqueuing it. * * @param reply the Reply to handle **/ - void handleReply(Reply::UP reply) override; + virtual void handleReply(Reply::UP reply) override; }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/sendproxy.h b/messagebus/src/vespa/messagebus/sendproxy.h index e0212c4c222..ca0c3f39661 100644 --- a/messagebus/src/vespa/messagebus/sendproxy.h +++ b/messagebus/src/vespa/messagebus/sendproxy.h @@ -34,8 +34,13 @@ public: */ SendProxy(MessageBus &mbus, INetwork &net, Resender *resender); + // Implements IDiscardHandler. void handleDiscard(Context ctx) override; + + // Implements IMessageHandler. void handleMessage(Message::UP msg) override; + + // Implements IReplyHandler. void handleReply(Reply::UP reply) override; }; diff --git a/messagebus/src/vespa/messagebus/staticthrottlepolicy.h b/messagebus/src/vespa/messagebus/staticthrottlepolicy.h index 586451ea83a..b7cc6bdfe99 100644 --- a/messagebus/src/vespa/messagebus/staticthrottlepolicy.h +++ b/messagebus/src/vespa/messagebus/staticthrottlepolicy.h @@ -70,8 +70,13 @@ public: */ uint64_t getPendingSize() const; + // Implements IThrottlePolicy. bool canSend(const Message &msg, uint32_t pendingCount) override; + + // Implements IThrottlePolicy. void processMessage(Message &msg) override; + + // Implements IThrottlePolicy. void processReply(Reply &reply) override; }; diff --git a/messagebus/src/vespa/messagebus/systemtimer.h b/messagebus/src/vespa/messagebus/systemtimer.h index 4a83add0732..14156253067 100644 --- a/messagebus/src/vespa/messagebus/systemtimer.h +++ b/messagebus/src/vespa/messagebus/systemtimer.h @@ -12,6 +12,7 @@ namespace mbus { */ class SystemTimer : public ITimer { public: + // Implements ITimer. uint64_t getMilliTime() const override; }; diff --git a/messagebus/src/vespa/messagebus/testlib/custompolicy.h b/messagebus/src/vespa/messagebus/testlib/custompolicy.h index 4fec4efe7c2..953f4f3c92e 100644 --- a/messagebus/src/vespa/messagebus/testlib/custompolicy.h +++ b/messagebus/src/vespa/messagebus/testlib/custompolicy.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 "simpleprotocol.h" #include <vespa/messagebus/routing/iroutingpolicy.h> +#include "simpleprotocol.h" namespace mbus { @@ -17,8 +17,8 @@ public: const std::vector<uint32_t> consumableErrors, const std::vector<Route> &routes); - void select(RoutingContext &context) override; - void merge(RoutingContext &context) override; + virtual void select(RoutingContext &context) override; + virtual void merge(RoutingContext &context) override; }; class CustomPolicyFactory : public SimpleProtocol::IPolicyFactory { @@ -37,3 +37,4 @@ public: }; } // namespace mbus + diff --git a/messagebus/src/vespa/messagebus/testlib/receptor.h b/messagebus/src/vespa/messagebus/testlib/receptor.h index 2e9a424b481..c64e60eb6de 100644 --- a/messagebus/src/vespa/messagebus/testlib/receptor.h +++ b/messagebus/src/vespa/messagebus/testlib/receptor.h @@ -20,10 +20,11 @@ private: Receptor &operator=(const Receptor &); public: Receptor(); - void handleMessage(Message::UP msg) override; - void handleReply(Reply::UP reply) override; + virtual void handleMessage(Message::UP msg) override; + virtual void handleReply(Reply::UP reply) override; Message::UP getMessage(double maxWait = 120.0); Reply::UP getReply(double maxWait = 120.0); }; } // namespace mbus + diff --git a/messagebus/src/vespa/messagebus/testlib/simplemessage.h b/messagebus/src/vespa/messagebus/testlib/simplemessage.h index aeee34045ff..cb14c48dd9f 100644 --- a/messagebus/src/vespa/messagebus/testlib/simplemessage.h +++ b/messagebus/src/vespa/messagebus/testlib/simplemessage.h @@ -8,9 +8,9 @@ namespace mbus { class SimpleMessage : public Message { private: - string _value; - bool _hasSeqId; - uint64_t _seqId; + string _value; + bool _hasSeqId; + uint64_t _seqId; public: SimpleMessage(const string &str); @@ -25,7 +25,9 @@ public: bool hasSequenceId() const override; uint64_t getSequenceId() const override; uint32_t getApproxSize() const override; + uint8_t priority() const override { return 8; } + string toString() const override { return _value; } }; diff --git a/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h b/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h index 0551d177898..843b7675b96 100644 --- a/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h +++ b/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h @@ -2,8 +2,9 @@ #pragma once -#include <vespa/messagebus/iprotocol.h> #include <map> +#include <string> +#include <vespa/messagebus/iprotocol.h> namespace mbus { @@ -48,7 +49,10 @@ public: */ SimpleProtocol(); - ~SimpleProtocol(); + /** + * Frees up any allocated resources. + */ + virtual ~SimpleProtocol(); /** * Registers a policy factory with this protocol under a given name. Whenever a policy is requested that @@ -68,10 +72,19 @@ public: */ static void simpleMerge(RoutingContext &ctx); + // Implements IProtocol. const string & getName() const override; - IRoutingPolicy::UP createPolicy(const string &name, const string ¶m) const override; + + // Implements IProtocol. + IRoutingPolicy::UP createPolicy(const string &name, + const string ¶m) const override; + + // Implements IProtocol. Blob encode(const vespalib::Version &version, const Routable &routable) const override; + + // Implements IProtocol. Routable::UP decode(const vespalib::Version &version, BlobRef data) const override; }; } // namespace mbus + diff --git a/messagebus/src/vespa/messagebus/testlib/simplereply.h b/messagebus/src/vespa/messagebus/testlib/simplereply.h index 3b9ac7fe21e..8016a517453 100644 --- a/messagebus/src/vespa/messagebus/testlib/simplereply.h +++ b/messagebus/src/vespa/messagebus/testlib/simplereply.h @@ -2,8 +2,9 @@ #pragma once -#include "simplemessage.h" +#include <string> #include <vespa/messagebus/reply.h> +#include "simplemessage.h" namespace mbus { @@ -18,10 +19,11 @@ public: virtual ~SimpleReply(); void setValue(const string &value); const string &getValue() const; - const string & getProtocol() const override; - uint32_t getType() const override; + virtual const string & getProtocol() const override; + virtual uint32_t getType() const override; uint8_t priority() const override { return 8; } }; } // namespace mbus + diff --git a/messagebus/src/vespa/messagebus/testlib/slobrok.cpp b/messagebus/src/vespa/messagebus/testlib/slobrok.cpp index fa71cb9f9ad..b3f02b1ad58 100644 --- a/messagebus/src/vespa/messagebus/testlib/slobrok.cpp +++ b/messagebus/src/vespa/messagebus/testlib/slobrok.cpp @@ -20,8 +20,7 @@ public: guard.wait(); } } - - void PerformTask() override { + virtual void PerformTask() override { vespalib::MonitorGuard guard(_mon); _done = true; guard.signal(); diff --git a/messagebus/src/vespa/messagebus/testlib/slobrok.h b/messagebus/src/vespa/messagebus/testlib/slobrok.h index 1677f6635f7..2f8d4180ba5 100644 --- a/messagebus/src/vespa/messagebus/testlib/slobrok.h +++ b/messagebus/src/vespa/messagebus/testlib/slobrok.h @@ -2,6 +2,7 @@ #pragma once +#include <memory> #include <vespa/messagebus/common.h> #include <vespa/slobrok/cfg.h> |