diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-01 15:32:15 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-01 18:03:25 +0200 |
commit | 61a4ea34c2ddd3b618249b6f6eb402069e40bccb (patch) | |
tree | 6d6e8d55bfd574a0d2d039a07099774d2545f32e | |
parent | 54581b5ecd98230dc90fe787f1f02a33ebffbff6 (diff) |
Removed frt.h from header files to reduce include volume.
36 files changed, 210 insertions, 191 deletions
diff --git a/config/src/apps/configproxy-cmd/proxycmd.cpp b/config/src/apps/configproxy-cmd/proxycmd.cpp index 794c005f485..df37333f514 100644 --- a/config/src/apps/configproxy-cmd/proxycmd.cpp +++ b/config/src/apps/configproxy-cmd/proxycmd.cpp @@ -1,8 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "proxycmd.h" -#include <iostream> #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/fnet/frt/supervisor.h> +#include <vespa/fnet/frt/target.h> +#include <vespa/fnet/frt/rpcrequest.h> + +#include <iostream> Flags::Flags(const Flags &) = default; Flags & Flags::operator=(const Flags &) = default; diff --git a/config/src/apps/configproxy-cmd/proxycmd.h b/config/src/apps/configproxy-cmd/proxycmd.h index a0ef02edaae..57b4d83fd42 100644 --- a/config/src/apps/configproxy-cmd/proxycmd.h +++ b/config/src/apps/configproxy-cmd/proxycmd.h @@ -1,7 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/fnet/frt/frt.h> +#include <vespa/vespalib/stllike/string.h> +#include <vector> + +class FRT_Supervisor; +class FRT_Target; +class FRT_RPCRequest; +class FRT_Values; struct Flags { vespalib::string method; @@ -30,9 +36,7 @@ private: void autoPrint(); public: ProxyCmd(const Flags& flags); - virtual ~ProxyCmd(); - int action(); }; diff --git a/config/src/vespa/config/file_acquirer/file_acquirer.cpp b/config/src/vespa/config/file_acquirer/file_acquirer.cpp index 147da7caaf9..37d66c11453 100644 --- a/config/src/vespa/config/file_acquirer/file_acquirer.cpp +++ b/config/src/vespa/config/file_acquirer/file_acquirer.cpp @@ -1,24 +1,28 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "file_acquirer.h" +#include <vespa/fnet/frt/supervisor.h> +#include <vespa/fnet/frt/target.h> +#include <vespa/fnet/frt/rpcrequest.h> + #include <vespa/log/log.h> LOG_SETUP(".config.file_acquirer"); namespace config { RpcFileAcquirer::RpcFileAcquirer(const vespalib::string &spec) - : _orb(), + : _orb(std::make_unique<FRT_Supervisor>()), _spec(spec) { - _orb.Start(); + _orb->Start(); } vespalib::string RpcFileAcquirer::wait_for(const vespalib::string &file_ref, double timeout_s) { vespalib::string path; - FRT_Target *target = _orb.GetTarget(_spec.c_str()); - FRT_RPCRequest *req = _orb.AllocRPCRequest(); + FRT_Target *target = _orb->GetTarget(_spec.c_str()); + FRT_RPCRequest *req = _orb->AllocRPCRequest(); req->SetMethodName("waitFor"); req->GetParams()->AddString(file_ref.data(), file_ref.size()); target->InvokeSync(req, timeout_s); @@ -35,7 +39,7 @@ RpcFileAcquirer::wait_for(const vespalib::string &file_ref, double timeout_s) RpcFileAcquirer::~RpcFileAcquirer() { - _orb.ShutDown(true); + _orb->ShutDown(true); } } // namespace config diff --git a/config/src/vespa/config/file_acquirer/file_acquirer.h b/config/src/vespa/config/file_acquirer/file_acquirer.h index ff090c9e7c0..3623fd5775d 100644 --- a/config/src/vespa/config/file_acquirer/file_acquirer.h +++ b/config/src/vespa/config/file_acquirer/file_acquirer.h @@ -2,7 +2,8 @@ #pragma once #include <vespa/vespalib/stllike/string.h> -#include <vespa/fnet/frt/frt.h> + +class FRT_Supervisor; namespace config { @@ -22,7 +23,7 @@ struct FileAcquirer { class RpcFileAcquirer : public FileAcquirer { private: - FRT_Supervisor _orb; + std::unique_ptr<FRT_Supervisor> _orb; vespalib::string _spec; public: RpcFileAcquirer(const vespalib::string &spec); diff --git a/config/src/vespa/config/frt/frtconnection.cpp b/config/src/vespa/config/frt/frtconnection.cpp index 40e59000aef..301655d3fed 100644 --- a/config/src/vespa/config/frt/frtconnection.cpp +++ b/config/src/vespa/config/frt/frtconnection.cpp @@ -2,7 +2,10 @@ #include "frtconnection.h" #include <vespa/vespalib/util/atomic.h> #include <vespa/config/common/errorcode.h> -#include <time.h> +#include <vespa/fnet/frt/supervisor.h> +#include <vespa/fnet/frt/target.h> +#include <vespa/fnet/frt/rpcrequest.h> + #include <vespa/log/log.h> LOG_SETUP(".config.frt.frtconnection"); @@ -114,4 +117,9 @@ void FRTConnection::calculateSuspension(ErrorType type) } } +FRT_RPCRequest * +FRTConnection::allocRPCRequest() { + return _supervisor.AllocRPCRequest(); +} + } diff --git a/config/src/vespa/config/frt/frtconnection.h b/config/src/vespa/config/frt/frtconnection.h index d0a8163413c..8eb963dc878 100644 --- a/config/src/vespa/config/frt/frtconnection.h +++ b/config/src/vespa/config/frt/frtconnection.h @@ -2,12 +2,14 @@ #pragma once #include <string> -#include <vespa/fnet/frt/frt.h> #include <vespa/vespalib/util/sync.h> #include <vespa/vespalib/stllike/string.h> #include <vespa/config/common/timingvalues.h> #include "connection.h" +class FRT_Supervisor; +class FRT_Target; + namespace config { class FRTConnection : public Connection { @@ -35,10 +37,7 @@ public: FRTConnection(const vespalib::string & address, FRT_Supervisor & supervisor, const TimingValues & timingValues); ~FRTConnection(); - FRT_RPCRequest * allocRPCRequest() override { - return _supervisor.AllocRPCRequest(); - } - + FRT_RPCRequest * allocRPCRequest() override; void invoke(FRT_RPCRequest * req, double timeout, FRT_IRequestWait * waiter) override; const vespalib::string & getAddress() const override { return _address; } int64_t getSuspendedUntil() { return _suspendedUntil; } diff --git a/config/src/vespa/config/frt/frtconnectionpool.cpp b/config/src/vespa/config/frt/frtconnectionpool.cpp index 70225b9dd04..4f433667afc 100644 --- a/config/src/vespa/config/frt/frtconnectionpool.cpp +++ b/config/src/vespa/config/frt/frtconnectionpool.cpp @@ -2,7 +2,8 @@ #include "frtconnectionpool.h" #include <vespa/vespalib/util/host_name.h> -#include <cstdlib> +#include <vespa/fnet/frt/supervisor.h> +#include <vespa/fnet/transport.h> namespace config { @@ -26,27 +27,27 @@ FRTConnectionPool::FRTConnectionKey::operator==(const FRTConnectionKey& right) c } FRTConnectionPool::FRTConnectionPool(const ServerSpec & spec, const TimingValues & timingValues) - : _supervisor(), + : _supervisor(std::make_unique<FRT_Supervisor>()), _selectIdx(0), _hostname("") { for (size_t i(0); i < spec.numHosts(); i++) { FRTConnectionKey key(i, spec.getHost(i)); - _connections[key].reset(new FRTConnection(spec.getHost(i), _supervisor, timingValues)); + _connections[key].reset(new FRTConnection(spec.getHost(i), *_supervisor, timingValues)); } setHostname(); - _supervisor.Start(); + _supervisor->Start(); } FRTConnectionPool::~FRTConnectionPool() { - _supervisor.ShutDown(true); + _supervisor->ShutDown(true); } void FRTConnectionPool::syncTransport() { - _supervisor.GetTransport()->sync(); + _supervisor->GetTransport()->sync(); } Connection * @@ -147,5 +148,9 @@ FRTConnectionPool::setHostname() _hostname = vespalib::HostName::get(); } +FNET_Scheduler * +FRTConnectionPool::getScheduler() { + return _supervisor->GetScheduler(); +} } diff --git a/config/src/vespa/config/frt/frtconnectionpool.h b/config/src/vespa/config/frt/frtconnectionpool.h index d5af64bba93..ba09b9319b6 100644 --- a/config/src/vespa/config/frt/frtconnectionpool.h +++ b/config/src/vespa/config/frt/frtconnectionpool.h @@ -4,10 +4,10 @@ #include "frtconnection.h" #include "connectionfactory.h" #include <vespa/config/subscription/sourcespec.h> -#include <vespa/fnet/frt/frt.h> #include <vector> #include <string> #include <map> + namespace config { class FRTConnectionPool : public ConnectionFactory { @@ -32,7 +32,7 @@ private: int operator==(const FRTConnectionKey& right) const; }; - FRT_Supervisor _supervisor; + std::unique_ptr<FRT_Supervisor> _supervisor; int _selectIdx; vespalib::string _hostname; typedef std::map<FRTConnectionKey, FRTConnection::SP> ConnectionMap; @@ -56,7 +56,7 @@ public: */ void setHostname(const vespalib::string & hostname) { _hostname = hostname; } - FNET_Scheduler * getScheduler() override { return _supervisor.GetScheduler(); } + FNET_Scheduler * getScheduler() override; /** * Gets the hostname. diff --git a/config/src/vespa/config/frt/frtsource.h b/config/src/vespa/config/frt/frtsource.h index 653d182707b..fbcc55e09fe 100644 --- a/config/src/vespa/config/frt/frtsource.h +++ b/config/src/vespa/config/frt/frtsource.h @@ -1,15 +1,14 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once - #include "connectionfactory.h" #include "frtconfigagent.h" #include "frtconfigrequestfactory.h" #include <vespa/config/common/configkey.h> #include <vespa/config/common/configrequest.h> #include <vespa/config/common/source.h> +#include <vespa/fnet/frt/invoker.h> -#include <vespa/fnet/frt/frt.h> #include <vespa/vespalib/util/sync.h> namespace config { diff --git a/filedistribution/src/tests/rpc/testfileprovider.cpp b/filedistribution/src/tests/rpc/testfileprovider.cpp index ab374d4398a..acf12086437 100644 --- a/filedistribution/src/tests/rpc/testfileprovider.cpp +++ b/filedistribution/src/tests/rpc/testfileprovider.cpp @@ -5,7 +5,8 @@ #include "mockfileprovider.h" #include <vespa/filedistribution/rpc/filedistributorrpc.h> #include <vespa/frtstream/frtclientstream.h> -#include <iostream> +#include <vespa/fnet/frt/rpcrequest.h> +#include <vespa/fnet/frt/target.h> #include <boost/test/unit_test.hpp> namespace fd = filedistribution; diff --git a/fnet/src/vespa/fnet/frt/rpcrequest.h b/fnet/src/vespa/fnet/frt/rpcrequest.h index 2441fb081d3..a834606d92e 100644 --- a/fnet/src/vespa/fnet/frt/rpcrequest.h +++ b/fnet/src/vespa/fnet/frt/rpcrequest.h @@ -126,8 +126,8 @@ public: void SetMethodName(const char *methodName, uint32_t len); void SetMethodName(const char *methodName); - uint32_t GetMethodNameLen() { return _methodNameLen; } - const char *GetMethodName() { return _methodName; } + uint32_t GetMethodNameLen() const { return _methodNameLen; } + const char *GetMethodName() const { return _methodName; } void Print(uint32_t indent = 0); diff --git a/frtstream/src/vespa/frtstream/frtclientstream.cpp b/frtstream/src/vespa/frtstream/frtclientstream.cpp index 142b0d1fda0..e9e17b8e02b 100644 --- a/frtstream/src/vespa/frtstream/frtclientstream.cpp +++ b/frtstream/src/vespa/frtstream/frtclientstream.cpp @@ -1,6 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "frtclientstream.h" +#include <vespa/fnet/frt/target.h> +#include <vespa/fnet/frt/rpcrequest.h> using namespace fnet; diff --git a/frtstream/src/vespa/frtstream/frtclientstream.h b/frtstream/src/vespa/frtstream/frtclientstream.h index b47f1399d0f..b06a6af890d 100644 --- a/frtstream/src/vespa/frtstream/frtclientstream.h +++ b/frtstream/src/vespa/frtstream/frtclientstream.h @@ -2,16 +2,11 @@ #pragma once -//Requires gcc 3 or higher -#if ! defined(__GNUC__) || (__GNUC__ > 2) - - -#include <vespa/frtstream/frtstream.h> - +#include "frtstream.h" +#include <vespa/fnet/frt/supervisor.h> namespace frtstream { - class FrtClientStream : public FrtStream { FRT_Supervisor supervisor; FRT_RPCRequest* request; @@ -34,7 +29,3 @@ public: } //end namespace frtstream -#else -#error "Requires gcc 3 or higher" -#endif - diff --git a/frtstream/src/vespa/frtstream/frtstream.h b/frtstream/src/vespa/frtstream/frtstream.h index cd50b1eae32..43bcf1aa8f1 100644 --- a/frtstream/src/vespa/frtstream/frtstream.h +++ b/frtstream/src/vespa/frtstream/frtstream.h @@ -1,17 +1,15 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include <vespa/fnet/frt/values.h> #include <string> #include <memory> #include <algorithm> #include <iosfwd> #include <iterator> -#include <vespa/fastos/types.h> -#include <vespa/fnet/frt/frt.h> - - namespace frtstream { + class ConnectionException{}; class InvokationException{ public: @@ -85,8 +83,6 @@ public: }; - - } //end namespace frtstream diff --git a/frtstream/src/vespa/frtstream/frtstreamTemplateImp.hpp b/frtstream/src/vespa/frtstream/frtstreamTemplateImp.hpp index 4577f8a7e78..0f89b42e401 100644 --- a/frtstream/src/vespa/frtstream/frtstreamTemplateImp.hpp +++ b/frtstream/src/vespa/frtstream/frtstreamTemplateImp.hpp @@ -5,7 +5,6 @@ //Can be moved when(if ever) the export functionality //is implemented in the target compiler. - namespace frtstream { template<class U> diff --git a/messagebus/src/vespa/messagebus/rpcmessagebus.h b/messagebus/src/vespa/messagebus/rpcmessagebus.h index de120b55e62..9bd290c62d8 100644 --- a/messagebus/src/vespa/messagebus/rpcmessagebus.h +++ b/messagebus/src/vespa/messagebus/rpcmessagebus.h @@ -1,12 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/messagebus/network/rpcnetwork.h> -#include <string> -#include <vespa/config/helper/legacysubscriber.h> #include "messagebus.h" #include "configagent.h" #include "protocolset.h" +#include <vespa/messagebus/network/rpcnetwork.h> +#include <vespa/config/helper/legacysubscriber.h> namespace mbus { diff --git a/messagebus/src/vespa/messagebus/testlib/oosserver.h b/messagebus/src/vespa/messagebus/testlib/oosserver.h index a9ab128aa5d..6d067326bec 100644 --- a/messagebus/src/vespa/messagebus/testlib/oosserver.h +++ b/messagebus/src/vespa/messagebus/testlib/oosserver.h @@ -3,8 +3,8 @@ #pragma once #include <vespa/vespalib/util/sync.h> -#include <vespa/fnet/frt/frt.h> #include <vespa/slobrok/sbregister.h> +#include <vespa/fnet/frt/supervisor.h> #include <string> #include <vector> #include "oosstate.h" diff --git a/persistence/src/tests/proxy/providerstub_test.cpp b/persistence/src/tests/proxy/providerstub_test.cpp index db218ef81b8..1028e06b8bc 100644 --- a/persistence/src/tests/proxy/providerstub_test.cpp +++ b/persistence/src/tests/proxy/providerstub_test.cpp @@ -15,6 +15,9 @@ #include <vespa/vdslib/distribution/distribution.h> #include <vespa/vdslib/state/clusterstate.h> #include <vespa/config-stor-distribution.h> +#include <vespa/fnet/frt/supervisor.h> +#include <vespa/fnet/frt/rpcrequest.h> +#include <vespa/fnet/frt/target.h> using document::BucketId; using document::ByteBuffer; diff --git a/persistence/src/vespa/persistence/proxy/providerstub.cpp b/persistence/src/vespa/persistence/proxy/providerstub.cpp index 38d7ffab5f5..6d65d92693f 100644 --- a/persistence/src/vespa/persistence/proxy/providerstub.cpp +++ b/persistence/src/vespa/persistence/proxy/providerstub.cpp @@ -9,10 +9,13 @@ #include <vespa/document/update/documentupdate.h> #include <vespa/document/fieldvalue/document.h> #include <vespa/persistence/spi/persistenceprovider.h> -#include <persistence/spi/types.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/document/fieldset/fieldsetrepo.h> +#include <vespa/fnet/frt/values.h> +#include <vespa/fnet/frt/supervisor.h> +#include <vespa/fnet/frt/rpcrequest.h> + using document::BucketId; using document::ByteBuffer; @@ -25,8 +28,7 @@ using vespalib::makeClosure; using vespalib::makeTask; using vespalib::nbostream; -namespace storage { -namespace spi { +namespace storage::spi { namespace { LoadType defaultLoadType(0, "default"); @@ -870,16 +872,13 @@ void ProviderStub::RPC_removeEntry(FRT_RPCRequest *req) { } void ProviderStub::SetupRpcCalls() { - FRT_ReflectionBuilder rb(&_supervisor); + FRT_ReflectionBuilder rb(_supervisor.get()); addConnect(rb, FRT_METHOD(ProviderStub::RPC_connect), this); - addInitialize( - rb, FRT_METHOD(ProviderStub::RPC_initialize), this); - addGetPartitionStates( - rb, FRT_METHOD(ProviderStub::RPC_getPartitionStates), this); + addInitialize(rb, FRT_METHOD(ProviderStub::RPC_initialize), this); + addGetPartitionStates(rb, FRT_METHOD(ProviderStub::RPC_getPartitionStates), this); addListBuckets(rb, FRT_METHOD(ProviderStub::RPC_listBuckets), this); addSetClusterState(rb, FRT_METHOD(ProviderStub::RPC_setClusterState), this); - addSetActiveState( - rb, FRT_METHOD(ProviderStub::RPC_setActiveState), this); + addSetActiveState(rb, FRT_METHOD(ProviderStub::RPC_setActiveState), this); addGetBucketInfo(rb, FRT_METHOD(ProviderStub::RPC_getBucketInfo), this); addPut(rb, FRT_METHOD(ProviderStub::RPC_put), this); addRemoveById(rb, FRT_METHOD(ProviderStub::RPC_removeById), this); @@ -889,12 +888,10 @@ void ProviderStub::SetupRpcCalls() { addGet(rb, FRT_METHOD(ProviderStub::RPC_get), this); addCreateIterator(rb, FRT_METHOD(ProviderStub::RPC_createIterator), this); addIterate(rb, FRT_METHOD(ProviderStub::RPC_iterate), this); - addDestroyIterator( - rb, FRT_METHOD(ProviderStub::RPC_destroyIterator), this); + addDestroyIterator(rb, FRT_METHOD(ProviderStub::RPC_destroyIterator), this); addCreateBucket(rb, FRT_METHOD(ProviderStub::RPC_createBucket), this); addDeleteBucket(rb, FRT_METHOD(ProviderStub::RPC_deleteBucket), this); - addGetModifiedBuckets( - rb, FRT_METHOD(ProviderStub::RPC_getModifiedBuckets), this); + addGetModifiedBuckets(rb, FRT_METHOD(ProviderStub::RPC_getModifiedBuckets), this); addSplit(rb, FRT_METHOD(ProviderStub::RPC_split), this); addJoin(rb, FRT_METHOD(ProviderStub::RPC_join), this); addMove(rb, FRT_METHOD(ProviderStub::RPC_move), this); @@ -910,18 +907,22 @@ ProviderStub::ProviderStub(int port, uint32_t threads, _repo(&repo), _factory(factory), _provider(), - _providerCleanupTask(_supervisor.GetScheduler(), _executor, _provider) + _providerCleanupTask(_supervisor->GetScheduler(), _executor, _provider) { SetupRpcCalls(); - _supervisor.SetSessionFiniHook(FRT_METHOD(ProviderStub::HOOK_fini), this); - _supervisor.Start(); - _supervisor.Listen(port); + _supervisor->SetSessionFiniHook(FRT_METHOD(ProviderStub::HOOK_fini), this); + _supervisor->Start(); + _supervisor->Listen(port); } ProviderStub::~ProviderStub() { - _supervisor.ShutDown(true); + _supervisor->ShutDown(true); sync(); } -} // namespace spi -} // namespace storage +int +ProviderStub::getPort() const { + return _supervisor->GetListenPort(); +} + +} diff --git a/persistence/src/vespa/persistence/proxy/providerstub.h b/persistence/src/vespa/persistence/proxy/providerstub.h index ce831547ef9..eff3560cf20 100644 --- a/persistence/src/vespa/persistence/proxy/providerstub.h +++ b/persistence/src/vespa/persistence/proxy/providerstub.h @@ -2,11 +2,14 @@ #pragma once -#include <vespa/fnet/frt/frt.h> #include <vespa/vespalib/util/closure.h> #include <vespa/vespalib/util/threadstackexecutor.h> +#include <vespa/fnet/frt/invokable.h> +#include <vespa/fnet/task.h> #include <memory> +class FRT_Supervisor; + namespace document { class DocumentTypeRepo; } namespace storage { @@ -36,7 +39,7 @@ private: } }; - FRT_Supervisor _supervisor; + std::unique_ptr<FRT_Supervisor> _supervisor; vespalib::ThreadStackExecutor _executor; const document::DocumentTypeRepo *_repo; PersistenceProviderFactory &_factory; @@ -81,8 +84,8 @@ public: PersistenceProviderFactory &factory); ~ProviderStub(); - int getPort() const { return _supervisor.GetListenPort(); } bool hasClient() const { return (_provider.get() != 0); } + int getPort() const; void setRepo(const document::DocumentTypeRepo &repo) { _repo = &repo; } diff --git a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp index be32bb3fb18..80b78d420ec 100644 --- a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp +++ b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp @@ -10,6 +10,7 @@ #include <vespa/vespalib/data/databuffer.h> #include <vespa/document/util/compressor.h> #include <vespa/searchlib/common/transport.h> +#include <vespa/fnet/frt/rpcrequest.h> #include <vespa/log/log.h> LOG_SETUP("summaryengine_test"); diff --git a/searchcore/src/vespa/searchcore/proton/server/ooscli.cpp b/searchcore/src/vespa/searchcore/proton/server/ooscli.cpp index 7e382ca5087..bdf2dd486ad 100644 --- a/searchcore/src/vespa/searchcore/proton/server/ooscli.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/ooscli.cpp @@ -4,6 +4,7 @@ #include "proton.h" #include <vespa/slobrok/sbmirror.h> #include <vespa/messagebus/network/oosmanager.h> +#include <vespa/fnet/frt/supervisor.h> #include <vespa/log/log.h> LOG_SETUP(".proton.server.ooscli"); @@ -49,5 +50,4 @@ OosCli::PerformTask() Schedule(1.0); } - } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp index 48644a29c04..1d255c388d9 100644 --- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp @@ -2,10 +2,8 @@ #include "rpc_hooks.h" #include "proton.h" -#include <vespa/messagebus/emptyreply.h> -#include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/closuretask.h> -#include <vespa/searchcore/proton/common/statusreport.h> +#include <vespa/fnet/frt/supervisor.h> #include <vespa/log/log.h> LOG_SETUP(".proton.server.rtchooks"); @@ -120,12 +118,12 @@ RPCHooksBase::Session::Session() void RPCHooksBase::initRPC() { - _orb.SetSessionInitHook(FRT_METHOD(RPCHooksBase::initSession), this); - _orb.SetSessionFiniHook(FRT_METHOD(RPCHooksBase::finiSession), this); - _orb.SetSessionDownHook(FRT_METHOD(RPCHooksBase::downSession), this); - _orb.SetMethodMismatchHook(FRT_METHOD(RPCHooksBase::mismatch), this); + _orb->SetSessionInitHook(FRT_METHOD(RPCHooksBase::initSession), this); + _orb->SetSessionFiniHook(FRT_METHOD(RPCHooksBase::finiSession), this); + _orb->SetSessionDownHook(FRT_METHOD(RPCHooksBase::downSession), this); + _orb->SetMethodMismatchHook(FRT_METHOD(RPCHooksBase::mismatch), this); - FRT_ReflectionBuilder rb(&_orb); + FRT_ReflectionBuilder rb(_orb.get()); //------------------------------------------------------------------------- rb.DefineMethod("proton.enableSearching", "", "", true, FRT_METHOD(RPCHooksBase::rpc_enableSearching), this); @@ -194,10 +192,10 @@ RPCHooksBase::initRPC() RPCHooksBase::RPCHooksBase(Params ¶ms) : _proton(params.proton), _docsumByRPC(new DocsumByRPC(_proton.getDocsumBySlime())), - _orb(), - _regAPI(_orb, params.slobrok_config), + _orb(std::make_unique<FRT_Supervisor>()), + _regAPI(*_orb, params.slobrok_config), _executor(48, 128 * 1024), - _ooscli(params, _orb) + _ooscli(params, *_orb) { } @@ -206,8 +204,8 @@ RPCHooksBase::open(Params & params) { initRPC(); _regAPI.registerName((params.identity + "/realtimecontroller").c_str()); - _orb.Listen(params.rtcPort); - _orb.Start(); + _orb->Listen(params.rtcPort); + _orb->Start(); LOG(debug, "started monitoring interface"); } @@ -219,7 +217,7 @@ void RPCHooksBase::close() { LOG(info, "shutting down monitoring interface"); - _orb.ShutDown(true); + _orb->ShutDown(true); _executor.shutdown(); { MonitorGuard guard(_stateMonitor); diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h index 0af5eeaed77..26c7885cadf 100644 --- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h +++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h @@ -2,7 +2,6 @@ #pragma once -#include <vespa/fnet/frt/frt.h> #include <vespa/slobrok/sbregister.h> #include <vespa/vespalib/util/atomic.h> #include <vespa/vespalib/util/executor.h> @@ -61,13 +60,13 @@ private: fastos::TimeStamp _dueTime; }; - Proton & _proton; - std::unique_ptr<DocsumByRPC> _docsumByRPC; - FRT_Supervisor _orb; - slobrok::api::RegisterAPI _regAPI; - vespalib::Monitor _stateMonitor; - vespalib::ThreadStackExecutor _executor; - OosCli _ooscli; + Proton & _proton; + std::unique_ptr<DocsumByRPC> _docsumByRPC; + std::unique_ptr<FRT_Supervisor> _orb; + slobrok::api::RegisterAPI _regAPI; + vespalib::Monitor _stateMonitor; + vespalib::ThreadStackExecutor _executor; + OosCli _ooscli; void initRPC(); void letProtonDo(vespalib::Closure::UP closure); diff --git a/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.cpp b/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.cpp index 06abf5e65bc..99b39f68006 100644 --- a/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.cpp +++ b/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.cpp @@ -3,6 +3,7 @@ #include <vespa/document/util/compressor.h> #include <vespa/searchlib/util/slime_output_raw_buf_adapter.h> #include <vespa/searchlib/common/packets.h> +#include <vespa/fnet/frt/rpcrequest.h> #include <vespa/log/log.h> diff --git a/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.h b/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.h index 920facf76a2..d811a8924aa 100644 --- a/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.h +++ b/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.h @@ -3,7 +3,8 @@ #include <vespa/searchlib/engine/docsumapi.h> #include <vespa/vespalib/data/slime/slime.h> -#include <vespa/fnet/frt/frt.h> + +class FRT_RPCRequest; namespace proton { @@ -31,4 +32,3 @@ private: }; } - diff --git a/searchlib/src/vespa/searchlib/transactionlog/session.cpp b/searchlib/src/vespa/searchlib/transactionlog/session.cpp index 734c7da8055..6e7e5e0d8f5 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/session.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/session.cpp @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/searchlib/transactionlog/session.h> -#include <vespa/searchlib/transactionlog/domain.h> +#include "session.h" +#include "domain.h" +#include <vespa/fnet/frt/supervisor.h> #include <vespa/fastlib/io/bufferedfile.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/log/log.h> @@ -95,6 +96,10 @@ Session::visitOnly() finalize(); } +bool Session::finished() const { + return _finished || (_connection->GetState() != FNET_Connection::FNET_CONNECTED); +} + void Session::enQ(const SP & session, SerialNum serial, const Packet & packet) { diff --git a/searchlib/src/vespa/searchlib/transactionlog/session.h b/searchlib/src/vespa/searchlib/transactionlog/session.h index 6616e311aa4..6c49d90d2fd 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/session.h +++ b/searchlib/src/vespa/searchlib/transactionlog/session.h @@ -2,9 +2,9 @@ #pragma once #include "common.h" -#include <vespa/fnet/frt/frt.h> #include <vespa/vespalib/util/executor.h> #include <vespa/vespalib/util/sync.h> +#include <vespa/fnet/frt/invoker.h> #include <deque> class FastOS_FileInterface; @@ -32,7 +32,7 @@ public: bool inSync() const; bool continous() const { return _subscriber; } bool ok() const { return _ok; } - bool finished() const { return _finished || (_connection->GetState() != FNET_Connection::FNET_CONNECTED);} + bool finished() const; static void enQ(const SP & session, SerialNum serial, const Packet & packet); static Task::UP createTask(const Session::SP & session); private: diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp index df3aa1404ae..98b3e1b46ee 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp @@ -1,11 +1,16 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "translogclient.h" -#include <stdexcept> #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/fnet/frt/supervisor.h> +#include <vespa/fnet/frt/target.h> +#include <vespa/fnet/frt/rpcrequest.h> +#include <thread> #include <vespa/log/log.h> LOG_SETUP(".translogclient"); +using namespace std::chrono_literals; + namespace search { namespace transactionlog { @@ -18,27 +23,31 @@ using vespalib::LockGuard; TransLogClient::TransLogClient(const vespalib::string & rpcTarget) : _rpcTarget(rpcTarget), _sessions(), - _supervisor(), + _supervisor(std::make_unique<FRT_Supervisor>()), _target(NULL) { reconnect(); - exportRPC(_supervisor); - _supervisor.Start(); + exportRPC(*_supervisor); + _supervisor->Start(); } TransLogClient::~TransLogClient() { disconnect(); - _supervisor.ShutDown(true); + _supervisor->ShutDown(true); } bool TransLogClient::reconnect() { disconnect(); - _target = _supervisor.Get2WayTarget(_rpcTarget.c_str()); + _target = _supervisor->Get2WayTarget(_rpcTarget.c_str()); return isConnected(); } +bool TransLogClient::isConnected() const { + return (_target != NULL) && _target->IsValid(); +} + void TransLogClient::disconnect() { if (_target) { @@ -48,7 +57,7 @@ void TransLogClient::disconnect() bool TransLogClient::create(const vespalib::string & domain) { - FRT_RPCRequest *req = _supervisor.AllocRPCRequest(); + FRT_RPCRequest *req = _supervisor->AllocRPCRequest(); req->SetMethodName("createDomain"); req->GetParams()->AddString(domain.c_str()); int32_t retval(rpc(req)); @@ -58,7 +67,7 @@ bool TransLogClient::create(const vespalib::string & domain) bool TransLogClient::remove(const vespalib::string & domain) { - FRT_RPCRequest *req = _supervisor.AllocRPCRequest(); + FRT_RPCRequest *req = _supervisor->AllocRPCRequest(); req->SetMethodName("deleteDomain"); req->GetParams()->AddString(domain.c_str()); int32_t retval(rpc(req)); @@ -69,7 +78,7 @@ bool TransLogClient::remove(const vespalib::string & domain) TransLogClient::Session::UP TransLogClient::open(const vespalib::string & domain) { Session::UP session; - FRT_RPCRequest *req = _supervisor.AllocRPCRequest(); + FRT_RPCRequest *req = _supervisor->AllocRPCRequest(); req->SetMethodName("openDomain"); req->GetParams()->AddString(domain.c_str()); int32_t retval(rpc(req)); @@ -92,7 +101,7 @@ TransLogClient::Visitor::UP TransLogClient::createVisitor(const vespalib::string bool TransLogClient::listDomains(std::vector<vespalib::string> & dir) { - FRT_RPCRequest *req = _supervisor.AllocRPCRequest(); + FRT_RPCRequest *req = _supervisor->AllocRPCRequest(); req->SetMethodName("listDomains"); int32_t retval(rpc(req)); if (retval == 0) { @@ -227,7 +236,7 @@ bool TransLogClient::Session::commit(const vespalib::ConstBufferRef & buf) { bool retval(true); if (buf.size() != 0) { - FRT_RPCRequest *req = _tlc._supervisor.AllocRPCRequest(); + FRT_RPCRequest *req = _tlc._supervisor->AllocRPCRequest(); req->SetMethodName("domainCommit"); req->GetParams()->AddString(_domain.c_str()); req->GetParams()->AddData(buf.c_str(), buf.size()); @@ -251,7 +260,7 @@ bool TransLogClient::Session::commit(const vespalib::ConstBufferRef & buf) bool TransLogClient::Session::status(SerialNum & b, SerialNum & e, size_t & count) { - FRT_RPCRequest *req = _tlc._supervisor.AllocRPCRequest(); + FRT_RPCRequest *req = _tlc._supervisor->AllocRPCRequest(); req->SetMethodName("domainStatus"); req->GetParams()->AddString(_domain.c_str()); int32_t retval(_tlc.rpc(req)); @@ -266,7 +275,7 @@ bool TransLogClient::Session::status(SerialNum & b, SerialNum & e, size_t & coun bool TransLogClient::Session::erase(const SerialNum & to) { - FRT_RPCRequest *req = _tlc._supervisor.AllocRPCRequest(); + FRT_RPCRequest *req = _tlc._supervisor->AllocRPCRequest(); req->SetMethodName("domainPrune"); req->GetParams()->AddString(_domain.c_str()); req->GetParams()->AddInt64(to); @@ -282,7 +291,7 @@ bool TransLogClient::Session::erase(const SerialNum & to) bool TransLogClient::Session::sync(const SerialNum &syncTo, SerialNum &syncedTo) { - FRT_RPCRequest *req = _tlc._supervisor.AllocRPCRequest(); + FRT_RPCRequest *req = _tlc._supervisor->AllocRPCRequest(); req->SetMethodName("domainSync"); FRT_Values & params = *req->GetParams(); params.AddString(_domain.c_str()); @@ -348,7 +357,7 @@ bool TransLogClient::Session::init(FRT_RPCRequest *req) bool TransLogClient::Visitor::visit(const SerialNum & from, const SerialNum & to) { - FRT_RPCRequest *req = _tlc._supervisor.AllocRPCRequest(); + FRT_RPCRequest *req = _tlc._supervisor->AllocRPCRequest(); req->SetMethodName("domainVisit"); req->GetParams()->AddString(_domain.c_str()); req->GetParams()->AddInt64(from); @@ -358,7 +367,7 @@ bool TransLogClient::Visitor::visit(const SerialNum & from, const SerialNum & to bool TransLogClient::Subscriber::subscribe(const SerialNum & from) { - FRT_RPCRequest *req = _tlc._supervisor.AllocRPCRequest(); + FRT_RPCRequest *req = _tlc._supervisor->AllocRPCRequest(); req->SetMethodName("domainSubscribe"); req->GetParams()->AddString(_domain.c_str()); req->GetParams()->AddInt64(from); @@ -367,7 +376,7 @@ bool TransLogClient::Subscriber::subscribe(const SerialNum & from) bool TransLogClient::Session::run() { - FRT_RPCRequest *req = _tlc._supervisor.AllocRPCRequest(); + FRT_RPCRequest *req = _tlc._supervisor->AllocRPCRequest(); req->SetMethodName("domainSessionRun"); req->GetParams()->AddString(_domain.c_str()); req->GetParams()->AddInt32(_sessionId); @@ -381,12 +390,12 @@ bool TransLogClient::Session::close() int retval(0); if (_sessionId > 0) { do { - FRT_RPCRequest *req = _tlc._supervisor.AllocRPCRequest(); + FRT_RPCRequest *req = _tlc._supervisor->AllocRPCRequest(); req->SetMethodName("domainSessionClose"); req->GetParams()->AddString(_domain.c_str()); req->GetParams()->AddInt32(_sessionId); if ( (retval = _tlc.rpc(req)) > 0) { - FastOS_Thread::Sleep(10); + std::this_thread::sleep_for(10ms); } req->SubRef(); } while ( retval == 1 ); diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogclient.h b/searchlib/src/vespa/searchlib/transactionlog/translogclient.h index 802933b7d81..dbc53cc8608 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogclient.h +++ b/searchlib/src/vespa/searchlib/transactionlog/translogclient.h @@ -3,14 +3,16 @@ #include "common.h" #include <vespa/document/util/bytebuffer.h> -#include <vespa/fnet/frt/frt.h> -#include <map> -#include <vector> #include <vespa/vespalib/util/sync.h> #include <vespa/vespalib/util/buffer.h> +#include <vespa/fnet/frt/invokable.h> +#include <map> +#include <vector> + +class FRT_Supervisor; +class FRT_Target; -namespace search { -namespace transactionlog { +namespace search::transactionlog { class TransLogClient : private FRT_Invokable { @@ -102,7 +104,7 @@ public: Subscriber::UP createSubscriber(const vespalib::string & domain, Session::Callback & callBack); Visitor::UP createVisitor(const vespalib::string & domain, Session::Callback & callBack); - bool isConnected() const { return (_target != NULL) && _target->IsValid(); } + bool isConnected() const; void disconnect(); bool reconnect(); const vespalib::string &getRPCTarget() const { return _rpcTarget; } @@ -131,10 +133,9 @@ private: SessionMap _sessions; //Brute force lock for subscriptions. For multithread safety. vespalib::Lock _lock; - FRT_Supervisor _supervisor; + std::unique_ptr<FRT_Supervisor> _supervisor; FRT_Target * _target; }; } -} diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp index 81a52b186de..84f77c76f8c 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.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 "translogserver.h" -#include <fstream> #include <vespa/vespalib/util/stringfmt.h> -#include <stdexcept> -#include <vespa/log/log.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/exceptions.h> +#include <vespa/fnet/frt/supervisor.h> +#include <fstream> +#include <vespa/log/log.h> LOG_SETUP(".transactionlog.server"); using vespalib::make_string; @@ -14,14 +14,9 @@ using vespalib::stringref; using vespalib::IllegalArgumentException; using search::common::FileHeaderContext; -namespace search -{ +namespace search::transactionlog { -namespace transactionlog -{ - -namespace -{ +namespace { class SyncHandler : public FNET_Task { @@ -98,7 +93,7 @@ TransLogServer::TransLogServer(const vespalib::string &name, _defaultCrcType(defaultCrcType), _executor(maxThreads, 128*1024), _threadPool(8192, 1), - _supervisor(), + _supervisor(std::make_unique<FRT_Supervisor>()), _domains(), _reqQ(), _fileHeaderContext(fileHeaderContext) @@ -125,13 +120,13 @@ TransLogServer::TransLogServer(const vespalib::string &name, } } } - exportRPC(_supervisor); + exportRPC(*_supervisor); char listenSpec[32]; sprintf(listenSpec, "tcp/%d", listenPort); bool listenOk(false); for (int i(600); !listenOk && i; i--) { - if (_supervisor.Listen(listenSpec)) { - _supervisor.Start(); + if (_supervisor->Listen(listenSpec)) { + _supervisor->Start(); listenOk = true; } else { LOG(warning, "Failed listening at port %s trying for %d seconds more.", listenSpec, i); @@ -154,7 +149,7 @@ TransLogServer::~TransLogServer() { stop(); join(); - _supervisor.ShutDown(true); + _supervisor->ShutDown(true); } bool TransLogServer::onStop() @@ -256,9 +251,9 @@ TransLogServer::findDomain(const stringref &domainName) void TransLogServer::exportRPC(FRT_Supervisor & supervisor) { - _supervisor.SetSessionInitHook(FRT_METHOD(TransLogServer::initSession), this); - _supervisor.SetSessionFiniHook(FRT_METHOD(TransLogServer::finiSession), this); - _supervisor.SetSessionDownHook(FRT_METHOD(TransLogServer::downSession), this); + _supervisor->SetSessionInitHook(FRT_METHOD(TransLogServer::initSession), this); + _supervisor->SetSessionFiniHook(FRT_METHOD(TransLogServer::finiSession), this); + _supervisor->SetSessionDownHook(FRT_METHOD(TransLogServer::downSession), this); FRT_ReflectionBuilder rb( & supervisor); //-- Create Domain ----------------------------------------------------------- @@ -521,7 +516,7 @@ void TransLogServer::domainSubscribe(FRT_RPCRequest *req) if (domain) { SerialNum from(params[1]._intval64); LOG(debug, "domainSubscribe(%s, %" PRIu64 ")", domainName, from); - retval = domain->subscribe(domain, from, _supervisor, req->GetConnection()); + retval = domain->subscribe(domain, from, *_supervisor, req->GetConnection()); } ret.AddInt32(retval); } @@ -538,7 +533,7 @@ void TransLogServer::domainVisit(FRT_RPCRequest *req) SerialNum from(params[1]._intval64); SerialNum to(params[2]._intval64); LOG(debug, "domainVisit(%s, %" PRIu64 ", %" PRIu64 ")", domainName, from, to); - retval = domain->visit(domain, from, to, _supervisor, req->GetConnection()); + retval = domain->visit(domain, from, to, *_supervisor, req->GetConnection()); } ret.AddInt32(retval); } @@ -656,14 +651,9 @@ TransLogServer::domainSync(FRT_RPCRequest *req) return; } - SyncHandler *syncHandler = new SyncHandler(&_supervisor, - req, - domain, - session, - syncTo); + SyncHandler *syncHandler = new SyncHandler(_supervisor.get(), req, domain, session, syncTo); syncHandler->ScheduleNow(); } } -} diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.h b/searchlib/src/vespa/searchlib/transactionlog/translogserver.h index e37204e9ed1..1ef94bbee02 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.h +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.h @@ -1,23 +1,17 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/searchlib/transactionlog/domain.h> +#include "domain.h" #include <vespa/vespalib/util/document_runnable.h> #include <vespa/document/util/queue.h> +#include <vespa/fnet/frt/invokable.h> #include <mutex> -namespace search -{ - -namespace common -{ +namespace search { -class FileHeaderContext; +namespace common { class FileHeaderContext; } -} - -namespace transactionlog -{ +namespace transactionlog { class TransLogServerExplorer; @@ -96,7 +90,7 @@ private: const DomainPart::Crc _defaultCrcType; vespalib::ThreadStackExecutor _executor; FastOS_ThreadPool _threadPool; - FRT_Supervisor _supervisor; + std::unique_ptr<FRT_Supervisor> _supervisor; DomainList _domains; mutable std::mutex _lock; // Protects _domains std::mutex _fileLock; // Protects the creating and deleting domains including file system operations. diff --git a/storage/src/vespa/storage/storageserver/fnetlistener.cpp b/storage/src/vespa/storage/storageserver/fnetlistener.cpp index 2c557ba8614..5bbeba4aa16 100644 --- a/storage/src/vespa/storage/storageserver/fnetlistener.cpp +++ b/storage/src/vespa/storage/storageserver/fnetlistener.cpp @@ -14,17 +14,17 @@ namespace storage { FNetListener::FNetListener(CommunicationManager& comManager, const config::ConfigUri & configUri, uint32_t port) : _comManager(comManager), - _orb(), + _orb(std::make_unique<FRT_Supervisor>()), _closed(false), - _slobrokRegister(_orb, configUri) + _slobrokRegister(*_orb, configUri) { initRPC(); - if (!_orb.Listen(port)) { + if (!_orb->Listen(port)) { std::ostringstream ost; ost << "Failed to listen to RPC port " << port << "."; throw vespalib::IllegalStateException(ost.str(), VESPA_STRLOC); } - _orb.Start(); + _orb->Start(); } FNetListener::~FNetListener() @@ -49,13 +49,13 @@ FNetListener::close() { _closed = true; _slobrokRegister.unregisterName(_handle); - _orb.ShutDown(true); + _orb->ShutDown(true); } void FNetListener::initRPC() { - FRT_ReflectionBuilder rb(&_orb); + FRT_ReflectionBuilder rb(_orb.get()); rb.DefineMethod( "getnodestate3", "sii", "ss", true, diff --git a/storage/src/vespa/storage/storageserver/fnetlistener.h b/storage/src/vespa/storage/storageserver/fnetlistener.h index 40cd53eaa63..781f818b673 100644 --- a/storage/src/vespa/storage/storageserver/fnetlistener.h +++ b/storage/src/vespa/storage/storageserver/fnetlistener.h @@ -1,11 +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 <vespa/fnet/frt/frt.h> -#include <vespa/slobrok/sbmirror.h> #include <vespa/slobrok/sbregister.h> - namespace storage { class CommunicationManager; @@ -26,17 +23,15 @@ public: void registerHandle(const vespalib::stringref & handle); void close(); - // Used by unit tests. bool serviceExists(const vespalib::stringref & connectionSpec); private: - CommunicationManager& _comManager; - FRT_Supervisor _orb; - bool _closed; + CommunicationManager& _comManager; + std::unique_ptr<FRT_Supervisor> _orb; + bool _closed; slobrok::api::RegisterAPI _slobrokRegister; - vespalib::string _handle; + vespalib::string _handle; }; } - diff --git a/storage/src/vespa/storage/storageserver/rpcrequestwrapper.cpp b/storage/src/vespa/storage/storageserver/rpcrequestwrapper.cpp index 797ff9260a3..cd60b2739bf 100644 --- a/storage/src/vespa/storage/storageserver/rpcrequestwrapper.cpp +++ b/storage/src/vespa/storage/storageserver/rpcrequestwrapper.cpp @@ -1,6 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "rpcrequestwrapper.h" +#include <vespa/fnet/frt/rpcrequest.h> +#include <cassert> namespace storage { @@ -12,8 +14,7 @@ RPCRequestWrapper::RPCRequestWrapper(FRT_RPCRequest *req) RPCRequestWrapper::~RPCRequestWrapper() { if (_req != 0) { - _req->SetError(ERR_REQUEST_DELETED, - "Request deleted without having been replied to"); + _req->SetError(ERR_REQUEST_DELETED, "Request deleted without having been replied to"); _req->Return(); } } @@ -80,6 +81,11 @@ RPCRequestWrapper::returnRequest() } +const char * +RPCRequestWrapper::getMethodName() const { + return _req->GetMethodName(); +} + void RPCRequestWrapper::discardBlobs() { diff --git a/storage/src/vespa/storage/storageserver/rpcrequestwrapper.h b/storage/src/vespa/storage/storageserver/rpcrequestwrapper.h index a1e067ca974..fdb685cab27 100644 --- a/storage/src/vespa/storage/storageserver/rpcrequestwrapper.h +++ b/storage/src/vespa/storage/storageserver/rpcrequestwrapper.h @@ -1,7 +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 <vespa/fnet/frt/frt.h> +#include <cstdint> + +class FRT_RPCRequest; namespace storage { @@ -47,7 +49,7 @@ public: **/ void returnError(uint32_t errorCode, const char *errorMessage); - const char *getMethodName() { return _req->GetMethodName(); } + const char *getMethodName() const; void addReturnString(const char *str, uint32_t len=0); void addReturnInt(uint32_t value); void returnRequest(); @@ -67,4 +69,3 @@ private: }; } // namespace storage - |