diff options
author | Håvard Pettersen <havardpe@oath.com> | 2018-09-04 12:16:55 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2018-09-05 13:25:25 +0000 |
commit | f163bfa304b627aa0fda87b13bf4d22f5bf21fbf (patch) | |
tree | 9b1d694b790ac407417ea5dfa0f0ddbb0ae500b7 | |
parent | 3bcb5407524034b3206aef269fef52a196023504 (diff) |
remove non-instant invocation
38 files changed, 178 insertions, 181 deletions
diff --git a/config/src/tests/failover/failover.cpp b/config/src/tests/failover/failover.cpp index 0f4a7e6bf6f..990ca761e7e 100644 --- a/config/src/tests/failover/failover.cpp +++ b/config/src/tests/failover/failover.cpp @@ -38,7 +38,7 @@ struct RPCServer : public FRT_Invokable { void init(FRT_Supervisor * s) { FRT_ReflectionBuilder rb(s); - rb.DefineMethod("config.v3.getConfig", requestTypes.c_str(), responseTypes.c_str(), true, + rb.DefineMethod("config.v3.getConfig", requestTypes.c_str(), responseTypes.c_str(), FRT_METHOD(RPCServer::getConfig), this); } diff --git a/config/src/tests/file_acquirer/file_acquirer_test.cpp b/config/src/tests/file_acquirer/file_acquirer_test.cpp index 0d2e2bf9144..0453c6ddbd0 100644 --- a/config/src/tests/file_acquirer/file_acquirer_test.cpp +++ b/config/src/tests/file_acquirer/file_acquirer_test.cpp @@ -11,7 +11,7 @@ struct ServerFixture : FRT_Invokable { vespalib::string spec; void init_rpc() { FRT_ReflectionBuilder rb(&orb); - rb.DefineMethod("waitFor", "s", "s", true, FRT_METHOD(ServerFixture::RPC_waitFor), this); + rb.DefineMethod("waitFor", "s", "s", FRT_METHOD(ServerFixture::RPC_waitFor), this); rb.MethodDesc("wait for and resolve file reference"); rb.ParamDesc("file_ref", "file reference to wait for and resolve"); rb.ReturnDesc("file_path", "actual path to the requested file"); diff --git a/fnet/src/examples/frt/rpc/rpc_callback_client.cpp b/fnet/src/examples/frt/rpc/rpc_callback_client.cpp index 801de59b515..7c6434e870a 100644 --- a/fnet/src/examples/frt/rpc/rpc_callback_client.cpp +++ b/fnet/src/examples/frt/rpc/rpc_callback_client.cpp @@ -26,7 +26,7 @@ RPC::Init(FRT_Supervisor *s) { FRT_ReflectionBuilder rb(s); //------------------------------------------------------------------- - rb.DefineMethod("prod", "", "", true, + rb.DefineMethod("prod", "", "", FRT_METHOD(RPC::Prod), this); //------------------------------------------------------------------- } @@ -45,6 +45,7 @@ MyApp::Main() printf("usage : rpc_server <connectspec>\n"); return 1; } + bool ok = true; RPC rpc; FRT_Supervisor orb; rpc.Init(&orb); @@ -63,6 +64,7 @@ MyApp::Main() printf("[error(%d): %s]\n", req->GetErrorCode(), req->GetErrorMessage()); + ok = false; } printf("invokeCnt: %d\n", rpc.invokeCnt); @@ -76,6 +78,7 @@ MyApp::Main() printf("[error(%d): %s]\n", req->GetErrorCode(), req->GetErrorMessage()); + ok = false; } printf("invokeCnt: %d\n", rpc.invokeCnt); @@ -89,14 +92,18 @@ MyApp::Main() printf("[error(%d): %s]\n", req->GetErrorCode(), req->GetErrorMessage()); + ok = false; } printf("invokeCnt: %d\n", rpc.invokeCnt); + if (rpc.invokeCnt != 3) { + ok = false; + } req->SubRef(); target->SubRef(); orb.ShutDown(true); - return 0; + return ok ? 0 : 1; } diff --git a/fnet/src/examples/frt/rpc/rpc_callback_server.cpp b/fnet/src/examples/frt/rpc/rpc_callback_server.cpp index 33207282bcc..ac7b34ebda0 100644 --- a/fnet/src/examples/frt/rpc/rpc_callback_server.cpp +++ b/fnet/src/examples/frt/rpc/rpc_callback_server.cpp @@ -2,6 +2,7 @@ #include <vespa/fnet/frt/frt.h> #include <vespa/fastos/app.h> +#include <thread> #include <vespa/log/log.h> LOG_SETUP("rpc_callback_server"); @@ -12,9 +13,7 @@ struct RPC : public FRT_Invokable void Init(FRT_Supervisor *s); }; -void -RPC::CallBack(FRT_RPCRequest *req) -{ +void do_callback(FRT_RPCRequest *req) { FNET_Connection *conn = req->GetConnection(); FRT_RPCRequest *cb = new FRT_RPCRequest(); cb->SetMethodName(req->GetParams()->GetValue(0)._string._str); @@ -25,6 +24,14 @@ RPC::CallBack(FRT_RPCRequest *req) cb->GetErrorMessage()); } cb->SubRef(); + req->Return(); +} + +void +RPC::CallBack(FRT_RPCRequest *req) +{ + req->Detach(); + std::thread(do_callback, req).detach(); } void @@ -32,7 +39,7 @@ RPC::Init(FRT_Supervisor *s) { FRT_ReflectionBuilder rb(s); //------------------------------------------------------------------- - rb.DefineMethod("callBack", "s", "", false, + rb.DefineMethod("callBack", "s", "", FRT_METHOD(RPC::CallBack), this); //------------------------------------------------------------------- } diff --git a/fnet/src/examples/frt/rpc/rpc_server.cpp b/fnet/src/examples/frt/rpc/rpc_server.cpp index 8947663216e..03d618133c9 100644 --- a/fnet/src/examples/frt/rpc/rpc_server.cpp +++ b/fnet/src/examples/frt/rpc/rpc_server.cpp @@ -28,21 +28,21 @@ RPCServer::InitRPC(FRT_Supervisor *s) { FRT_ReflectionBuilder rb(s); //------------------------------------------------------------------- - rb.DefineMethod("concat", "ss", "s", true, + rb.DefineMethod("concat", "ss", "s", FRT_METHOD(RPCServer::RPC_concat), this); rb.MethodDesc("Concatenate two strings"); rb.ParamDesc("string1", "a string"); rb.ParamDesc("string2", "another string"); rb.ReturnDesc("ret", "the concatenation of string1 and string2"); //------------------------------------------------------------------- - rb.DefineMethod("addFloat", "ff", "f", true, + rb.DefineMethod("addFloat", "ff", "f", FRT_METHOD(RPCServer::RPC_addFloat), this); rb.MethodDesc("Add two floats"); rb.ParamDesc("float1", "a float"); rb.ParamDesc("float2", "another float"); rb.ReturnDesc("ret", "float1 + float2"); //------------------------------------------------------------------- - rb.DefineMethod("addDouble", "dd", "d", true, + rb.DefineMethod("addDouble", "dd", "d", FRT_METHOD(RPCServer::RPC_addDouble), this); rb.MethodDesc("Add two doubles"); rb.ParamDesc("double1", "a double"); diff --git a/fnet/src/tests/frt/method_pt/method_pt.cpp b/fnet/src/tests/frt/method_pt/method_pt.cpp index db5905d6871..5417fddceeb 100644 --- a/fnet/src/tests/frt/method_pt/method_pt.cpp +++ b/fnet/src/tests/frt/method_pt/method_pt.cpp @@ -207,35 +207,35 @@ void initTest() { //------------------------------------------------------------------- - rb.DefineMethod("simpleMethod", "", "", true, + rb.DefineMethod("simpleMethod", "", "", FRT_METHOD(SimpleHandler::RPC_Method), _simpleHandler); //------------------------------------------------------------------- - rb.DefineMethod("mediumMethod1", "", "", true, + rb.DefineMethod("mediumMethod1", "", "", FRT_METHOD(MediumHandler1::RPC_Method), _mediumHandler1); - rb.DefineMethod("mediumMethod2", "", "", true, + rb.DefineMethod("mediumMethod2", "", "", FRT_METHOD(MediumHandler2::RPC_Method), _mediumHandler2); - rb.DefineMethod("mediumMethod3", "", "", true, + rb.DefineMethod("mediumMethod3", "", "", FRT_METHOD(MediumHandler3::RPC_Method), _mediumHandler3); //------------------------------------------------------------------- - rb.DefineMethod("complexMethod1", "", "", true, + rb.DefineMethod("complexMethod1", "", "", FRT_METHOD(ComplexHandler1::RPC_Method), _complexHandler1); - rb.DefineMethod("complexMethod2", "", "", true, + rb.DefineMethod("complexMethod2", "", "", FRT_METHOD(ComplexHandler2::RPC_Method), _complexHandler2); - rb.DefineMethod("complexMethod3", "", "", true, + rb.DefineMethod("complexMethod3", "", "", FRT_METHOD(ComplexHandler3::RPC_Method), _complexHandler3); diff --git a/fnet/src/tests/frt/parallel_rpc/parallel_rpc_test.cpp b/fnet/src/tests/frt/parallel_rpc/parallel_rpc_test.cpp index 4f8b4b82743..dbead4adfe5 100644 --- a/fnet/src/tests/frt/parallel_rpc/parallel_rpc_test.cpp +++ b/fnet/src/tests/frt/parallel_rpc/parallel_rpc_test.cpp @@ -37,7 +37,7 @@ struct Server : Rpc { } void init_rpc() { FRT_ReflectionBuilder rb(&orb); - rb.DefineMethod("inc", "l", "l", true, FRT_METHOD(Server::rpc_inc), this); + rb.DefineMethod("inc", "l", "l", FRT_METHOD(Server::rpc_inc), this); rb.MethodDesc("increment a 64-bit integer"); rb.ParamDesc("in", "an integer (64 bit)"); rb.ReturnDesc("out", "in + 1 (64 bit)"); diff --git a/fnet/src/tests/frt/rpc/detach_return_invoke.cpp b/fnet/src/tests/frt/rpc/detach_return_invoke.cpp index 54a891261c2..ab21c62bb68 100644 --- a/fnet/src/tests/frt/rpc/detach_return_invoke.cpp +++ b/fnet/src/tests/frt/rpc/detach_return_invoke.cpp @@ -20,7 +20,7 @@ struct Server : public FRT_Invokable Server(FRT_Supervisor &s, Receptor &r) : orb(s), receptor(r) { FRT_ReflectionBuilder rb(&s); - rb.DefineMethod("hook", "", "", true, + rb.DefineMethod("hook", "", "", FRT_METHOD(Server::rpc_hook), this); } diff --git a/fnet/src/tests/frt/rpc/invoke.cpp b/fnet/src/tests/frt/rpc/invoke.cpp index 787adb227f9..e3bd662214f 100644 --- a/fnet/src/tests/frt/rpc/invoke.cpp +++ b/fnet/src/tests/frt/rpc/invoke.cpp @@ -124,7 +124,7 @@ public: assert(_echo_stash != nullptr && _echo_args != nullptr); FRT_ReflectionBuilder rb(supervisor); - rb.DefineMethod("echo", "*", "*", true, + rb.DefineMethod("echo", "*", "*", FRT_METHOD(EchoTest::RPC_Echo), this); FRT_Values *args = _echo_args; @@ -225,17 +225,15 @@ public: { FRT_ReflectionBuilder rb(supervisor); - rb.DefineMethod("inc", "i", "i", true, + rb.DefineMethod("inc", "i", "i", FRT_METHOD(TestRPC::RPC_Inc), this); - rb.DefineMethod("setValue", "i", "", true, + rb.DefineMethod("setValue", "i", "", FRT_METHOD(TestRPC::RPC_SetValue), this); - rb.DefineMethod("incValue", "", "", true, + rb.DefineMethod("incValue", "", "", FRT_METHOD(TestRPC::RPC_IncValue), this); - rb.DefineMethod("getValue", "", "i", true, + rb.DefineMethod("getValue", "", "i", FRT_METHOD(TestRPC::RPC_GetValue), this); - rb.DefineMethod("testFast", "iiibb", "i", true, - FRT_METHOD(TestRPC::RPC_Test), this); - rb.DefineMethod("testSlow", "iiibb", "i", false, + rb.DefineMethod("testFast", "iiibb", "i", FRT_METHOD(TestRPC::RPC_Test), this); } @@ -364,7 +362,6 @@ const char phase_names[PHASE_ZZZ][32] = enum { TIMING_NULL = 0, TIMING_INSTANT, - TIMING_NON_INSTANT, TIMING_ZZZ }; @@ -372,7 +369,6 @@ const char timing_names[TIMING_ZZZ][32] = { "nullptr", "INSTANT", - "NON-INSTANT" }; enum { @@ -451,17 +447,10 @@ struct State { void PrepareTestMethod() { NewReq(); - bool instant = (_timing == TIMING_INSTANT); - if (_timing != TIMING_INSTANT && - _timing != TIMING_NON_INSTANT) - { + if (_timing != TIMING_INSTANT) { ASSERT_TRUE(false); // consult your dealer... } - if (instant) { - _req->SetMethodName("testFast"); - } else { - _req->SetMethodName("testSlow"); - } + _req->SetMethodName("testFast"); } void SetTestParams(uint32_t value, uint32_t delay, @@ -928,9 +917,9 @@ TEST_F("invoke test", State()) { EXPECT_TRUE(_phase_simple_cnt == 1); EXPECT_TRUE(_phase_void_cnt == 1); EXPECT_TRUE(_phase_speed_cnt == 1); - EXPECT_TRUE(_phase_advanced_cnt == 4); - EXPECT_TRUE(_phase_error_cnt == 4); - EXPECT_TRUE(_phase_abort_cnt == 4); + EXPECT_TRUE(_phase_advanced_cnt == 2); + EXPECT_TRUE(_phase_error_cnt == 2); + EXPECT_TRUE(_phase_abort_cnt == 2); EXPECT_TRUE(_phase_echo_cnt == 1); } diff --git a/fnet/src/tests/frt/rpc/session.cpp b/fnet/src/tests/frt/rpc/session.cpp index b84db9b4e88..93f14647e21 100644 --- a/fnet/src/tests/frt/rpc/session.cpp +++ b/fnet/src/tests/frt/rpc/session.cpp @@ -77,9 +77,9 @@ struct RPC : public FRT_Invokable void Init(FRT_Supervisor *s) { FRT_ReflectionBuilder rb(s); - rb.DefineMethod("getValue", "", "i", true, + rb.DefineMethod("getValue", "", "i", FRT_METHOD(RPC::GetValue), this); - rb.DefineMethod("setValue", "i", "", true, + rb.DefineMethod("setValue", "i", "", FRT_METHOD(RPC::SetValue), this); s->SetSessionInitHook(FRT_METHOD(RPC::InitSession), this); s->SetSessionFiniHook(FRT_METHOD(RPC::FiniSession), this); diff --git a/fnet/src/tests/frt/rpc/sharedblob.cpp b/fnet/src/tests/frt/rpc/sharedblob.cpp index 10eaad9c013..a48ecbb1da7 100644 --- a/fnet/src/tests/frt/rpc/sharedblob.cpp +++ b/fnet/src/tests/frt/rpc/sharedblob.cpp @@ -176,7 +176,7 @@ TEST("testImplicitShared") { ServerSampler serverSampler(dataSet, req); { FRT_ReflectionBuilder rb(&orb); - rb.DefineMethod("test", "*", "*", true, + rb.DefineMethod("test", "*", "*", FRT_METHOD(ServerSampler::RPC_test), &serverSampler); } orb.Listen(0); diff --git a/fnet/src/tests/info/info.cpp b/fnet/src/tests/info/info.cpp index ecd21a7bd25..f76e66c2af6 100644 --- a/fnet/src/tests/info/info.cpp +++ b/fnet/src/tests/info/info.cpp @@ -24,7 +24,7 @@ struct RPC : public FRT_Invokable { FRT_ReflectionBuilder rb(s); //------------------------------------------------------------------- - rb.DefineMethod("getInfo", "", "sssii", true, + rb.DefineMethod("getInfo", "", "sssii", FRT_METHOD(RPC::GetInfo), this); // FastOS version // FNET version diff --git a/fnet/src/vespa/fnet/frt/invoker.cpp b/fnet/src/vespa/fnet/frt/invoker.cpp index f2dc331c707..b174c3a710e 100644 --- a/fnet/src/vespa/fnet/frt/invoker.cpp +++ b/fnet/src/vespa/fnet/frt/invoker.cpp @@ -64,18 +64,14 @@ FRT_RPCInvoker::FRT_RPCInvoker(FRT_Supervisor *supervisor, req->SetReturnHandler(this); } -bool FRT_RPCInvoker::IsInstant() { - return _method->IsInstant(); -} - -bool FRT_RPCInvoker::Invoke(bool freeChannel) +bool FRT_RPCInvoker::Invoke() { bool detached = false; _req->SetDetachedPT(&detached); (_method->GetHandler()->*_method->GetMethod())(_req); if (detached) return false; - HandleDone(freeChannel); + HandleDone(false); return true; } @@ -120,13 +116,6 @@ FRT_RPCInvoker::GetConnection() return _req->GetContext()._value.CHANNEL->GetConnection(); } - -void -FRT_RPCInvoker::Run(FastOS_ThreadInterface *, void *) -{ - Invoke(true); -} - //----------------------------------------------------------------------------- void FRT_HookInvoker::Invoke() diff --git a/fnet/src/vespa/fnet/frt/invoker.h b/fnet/src/vespa/fnet/frt/invoker.h index 15d74017200..64adf66688e 100644 --- a/fnet/src/vespa/fnet/frt/invoker.h +++ b/fnet/src/vespa/fnet/frt/invoker.h @@ -59,8 +59,7 @@ public: //----------------------------------------------------------------------------- -class FRT_RPCInvoker : public FastOS_Runnable, - public FRT_IReturnHandler +class FRT_RPCInvoker : public FRT_IReturnHandler { private: FRT_RPCRequest *_req; @@ -76,15 +75,13 @@ public: bool noReply); void ForceMethod(FRT_Method *method) { _method = method; } - bool IsInstant(); FRT_RPCRequest *GetRequest() { return _req; } void HandleDone(bool freeChannel); - bool Invoke(bool freeChannel); + bool Invoke(); void HandleReturn() override; FNET_Connection *GetConnection() override; - void Run(FastOS_ThreadInterface *, void *) override; }; //----------------------------------------------------------------------------- diff --git a/fnet/src/vespa/fnet/frt/reflection.cpp b/fnet/src/vespa/fnet/frt/reflection.cpp index 4285c512ebf..305294f4a3c 100644 --- a/fnet/src/vespa/fnet/frt/reflection.cpp +++ b/fnet/src/vespa/fnet/frt/reflection.cpp @@ -6,13 +6,12 @@ #include "supervisor.h" FRT_Method::FRT_Method(const char * name, const char * paramSpec, const char * returnSpec, - bool instant, FRT_METHOD_PT method, FRT_Invokable * handler) + FRT_METHOD_PT method, FRT_Invokable * handler) : _hashNext(nullptr), _listNext(nullptr), _name(strdup(name)), _paramSpec(strdup(paramSpec)), _returnSpec(strdup(returnSpec)), - _instant(instant), _method(method), _handler(handler), _docLen(0), @@ -171,7 +170,6 @@ void FRT_ReflectionBuilder::DefineMethod(const char *name, const char *paramSpec, const char *returnSpec, - bool instant, FRT_METHOD_PT method, FRT_Invokable *handler) { @@ -182,7 +180,6 @@ FRT_ReflectionBuilder::DefineMethod(const char *name, _method = new FRT_Method(name, paramSpec, returnSpec, - instant, method, handler); _lookup->AddMethod(_method); diff --git a/fnet/src/vespa/fnet/frt/reflection.h b/fnet/src/vespa/fnet/frt/reflection.h index 466e58413e9..5189cf81d0a 100644 --- a/fnet/src/vespa/fnet/frt/reflection.h +++ b/fnet/src/vespa/fnet/frt/reflection.h @@ -19,7 +19,6 @@ private: char *_name; // method name char *_paramSpec; // method parameter spec char *_returnSpec; // method return spec - bool _instant; // method is instant ? FRT_METHOD_PT _method; // method pointer FRT_Invokable *_handler; // method handler uint32_t _docLen; // method documentation length @@ -32,7 +31,6 @@ public: FRT_Method(const char *name, const char *paramSpec, const char *returnSpec, - bool instant, FRT_METHOD_PT method, FRT_Invokable *handler); @@ -42,7 +40,6 @@ public: const char *GetName() { return _name; } const char *GetParamSpec() { return _paramSpec; } const char *GetReturnSpec() { return _returnSpec; } - bool IsInstant() { return _instant; } FRT_METHOD_PT GetMethod() { return _method; } FRT_Invokable *GetHandler() { return _handler; } void SetDocumentation(FRT_Values *values); @@ -121,7 +118,6 @@ public: void DefineMethod(const char *name, const char *paramSpec, const char *returnSpec, - bool instant, FRT_METHOD_PT method, FRT_Invokable *handler); void MethodDesc(const char *desc); diff --git a/fnet/src/vespa/fnet/frt/rpcrequest.h b/fnet/src/vespa/fnet/frt/rpcrequest.h index a10653ce2f6..cc871e7ac0c 100644 --- a/fnet/src/vespa/fnet/frt/rpcrequest.h +++ b/fnet/src/vespa/fnet/frt/rpcrequest.h @@ -133,7 +133,7 @@ public: FNET_Packet *CreateReplyPacket(); void SetDetachedPT(bool *detachedPT) { _detachedPT = detachedPT; } - void Detach() { *_detachedPT = true; } + FRT_RPCRequest *Detach() { *_detachedPT = true; return this; } void SetAbortHandler(FRT_IAbortHandler *handler) { _abortHandler = handler; } void SetReturnHandler(FRT_IReturnHandler *handler) { _returnHandler = handler; } diff --git a/fnet/src/vespa/fnet/frt/supervisor.cpp b/fnet/src/vespa/fnet/frt/supervisor.cpp index 927e2e84b94..e509223c005 100644 --- a/fnet/src/vespa/fnet/frt/supervisor.cpp +++ b/fnet/src/vespa/fnet/frt/supervisor.cpp @@ -91,22 +91,6 @@ FRT_Supervisor::GetListenPort() const } -bool -FRT_Supervisor::RunInvocation(FRT_RPCInvoker *invoker) -{ - // XXX: implement queue with max length + max # threads - - if (_threadPool == nullptr || - _threadPool->NewThread(invoker) == nullptr) - { - invoker->GetRequest()->SetError(FRTE_RPC_OVERLOAD, - "Could not start thread"); - return false; - } - return true; -} - - FRT_Target * FRT_Supervisor::GetTarget(const char *spec) { @@ -179,7 +163,7 @@ FRT_Supervisor::SetMethodMismatchHook(FRT_METHOD_PT method, { delete _methodMismatchHook; _methodMismatchHook = new FRT_Method("frt.hook.methodMismatch", "*", "*", - true, method, handler); + method, handler); assert(_methodMismatchHook != nullptr); } @@ -284,25 +268,17 @@ FRT_Supervisor::HandlePacket(FNET_Packet *packet, FNET_Context context) && _methodMismatchHook != nullptr) { invoker->ForceMethod(_methodMismatchHook); - return (invoker->Invoke(false)) ? + return (invoker->Invoke()) ? FNET_FREE_CHANNEL : FNET_CLOSE_CHANNEL; } invoker->HandleDone(false); return FNET_FREE_CHANNEL; - } else if (invoker->IsInstant()) { - - return (invoker->Invoke(false)) ? - FNET_FREE_CHANNEL : FNET_CLOSE_CHANNEL; - } else { - if (!RunInvocation(invoker)) { - invoker->HandleDone(false); - return FNET_FREE_CHANNEL; - } - return FNET_CLOSE_CHANNEL; + return (invoker->Invoke()) ? + FNET_FREE_CHANNEL : FNET_CLOSE_CHANNEL; } } @@ -349,17 +325,17 @@ FRT_Supervisor::RPCHooks::InitRPC(FRT_Supervisor *supervisor) { FRT_ReflectionBuilder rb(supervisor); //--------------------------------------------------------------------------- - rb.DefineMethod("frt.rpc.ping", "", "", true, + rb.DefineMethod("frt.rpc.ping", "", "", FRT_METHOD(FRT_Supervisor::RPCHooks::RPC_Ping), this); rb.MethodDesc("Method that may be used to check if the server is online"); //--------------------------------------------------------------------------- - rb.DefineMethod("frt.rpc.echo", "*", "*", true, + rb.DefineMethod("frt.rpc.echo", "*", "*", FRT_METHOD(FRT_Supervisor::RPCHooks::RPC_Echo), this); rb.MethodDesc("Echo the parameters as return values"); rb.ParamDesc("params", "Any set of parameters"); rb.ReturnDesc("return", "The parameter values"); //--------------------------------------------------------------------------- - rb.DefineMethod("frt.rpc.getMethodList", "", "SSS", true, + rb.DefineMethod("frt.rpc.getMethodList", "", "SSS", FRT_METHOD(FRT_Supervisor::RPCHooks::RPC_GetMethodList), this); rb.MethodDesc("Obtain a list of all available methods"); @@ -367,7 +343,7 @@ FRT_Supervisor::RPCHooks::InitRPC(FRT_Supervisor *supervisor) rb.ReturnDesc("params", "Method parameter types"); rb.ReturnDesc("return", "Method return types"); //--------------------------------------------------------------------------- - rb.DefineMethod("frt.rpc.getMethodInfo", "s", "sssSSSS", true, + rb.DefineMethod("frt.rpc.getMethodInfo", "s", "sssSSSS", FRT_METHOD(FRT_Supervisor::RPCHooks::RPC_GetMethodInfo), this); rb.MethodDesc("Obtain detailed information about a single method"); @@ -448,7 +424,7 @@ FRT_Supervisor::ConnHooks::SetSessionInitHook(FRT_METHOD_PT method, { delete _sessionInitHook; _sessionInitHook = new FRT_Method("frt.hook.sessionInit", "", "", - true, method, handler); + method, handler); assert(_sessionInitHook != nullptr); } @@ -459,7 +435,7 @@ FRT_Supervisor::ConnHooks::SetSessionDownHook(FRT_METHOD_PT method, { delete _sessionDownHook; _sessionDownHook = new FRT_Method("frt.hook.sessionDown", "", "", - true, method, handler); + method, handler); assert(_sessionDownHook != nullptr); } @@ -470,7 +446,7 @@ FRT_Supervisor::ConnHooks::SetSessionFiniHook(FRT_METHOD_PT method, { delete _sessionFiniHook; _sessionFiniHook = new FRT_Method("frt.hook.sessionFini", "", "", - true, method, handler); + method, handler); assert(_sessionFiniHook != nullptr); } diff --git a/fnet/src/vespa/fnet/frt/supervisor.h b/fnet/src/vespa/fnet/frt/supervisor.h index 051c1caceeb..dc7fb496239 100644 --- a/fnet/src/vespa/fnet/frt/supervisor.h +++ b/fnet/src/vespa/fnet/frt/supervisor.h @@ -99,8 +99,6 @@ public: bool Listen(int port); uint32_t GetListenPort() const; - bool RunInvocation(FRT_RPCInvoker *invoker); - FRT_Target *GetTarget(const char *spec); FRT_Target *Get2WayTarget(const char *spec, FNET_Context connContext = FNET_Context()); diff --git a/jrt_test/src/jrt-test/simpleserver/simpleserver.cpp b/jrt_test/src/jrt-test/simpleserver/simpleserver.cpp index a0781ee4720..89d8cd881a8 100644 --- a/jrt_test/src/jrt-test/simpleserver/simpleserver.cpp +++ b/jrt_test/src/jrt-test/simpleserver/simpleserver.cpp @@ -14,19 +14,19 @@ public: { FRT_ReflectionBuilder rb(s); //--------------------------------------------------------------------- - rb.DefineMethod("inc", "i", "i", true, + rb.DefineMethod("inc", "i", "i", FRT_METHOD(Server::rpc_inc), this); rb.MethodDesc("Increase an integer value"); rb.ParamDesc("value", "initial value"); rb.ReturnDesc("result", "value + 1"); //--------------------------------------------------------------------- - rb.DefineMethod("blob", "x", "x", true, + rb.DefineMethod("blob", "x", "x", FRT_METHOD(Server::rpc_blob), this); rb.MethodDesc("Send a copy of a blob back to the client"); rb.ParamDesc("blob", "the original blob"); rb.ReturnDesc("blob", "a copy of the original blob"); //--------------------------------------------------------------------- - rb.DefineMethod("test", "iib", "i", true, + rb.DefineMethod("test", "iib", "i", FRT_METHOD(Server::rpc_test), this); rb.MethodDesc("Magic test method"); rb.ParamDesc("value", "the value"); diff --git a/jrt_test/src/tests/mockup-invoke/mockup-server.cpp b/jrt_test/src/tests/mockup-invoke/mockup-server.cpp index 32c9bcc6c21..8456bee1e41 100644 --- a/jrt_test/src/tests/mockup-invoke/mockup-server.cpp +++ b/jrt_test/src/tests/mockup-invoke/mockup-server.cpp @@ -14,7 +14,7 @@ public: { FRT_ReflectionBuilder rb(s); //------------------------------------------------------------------- - rb.DefineMethod("concat", "ss", "s", true, + rb.DefineMethod("concat", "ss", "s", FRT_METHOD(MockupServer::RPC_concat), this); rb.MethodDesc("Concatenate two strings"); rb.ParamDesc("string1", "a string"); diff --git a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp index 913338785f2..b72416f51d2 100644 --- a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp +++ b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp @@ -187,7 +187,7 @@ RPCNetwork::attach(INetworkOwner &owner) _sendAdapters[vespalib::Version(6, 149)] = _sendV2.get(); FRT_ReflectionBuilder builder(_orb.get()); - builder.DefineMethod("mbus.getVersion", "", "s", true, FRT_METHOD(RPCNetwork::invoke), this); + builder.DefineMethod("mbus.getVersion", "", "s", FRT_METHOD(RPCNetwork::invoke), this); builder.MethodDesc("Retrieves the message bus version."); builder.ReturnDesc("version", "The message bus version."); } diff --git a/messagebus/src/vespa/messagebus/network/rpcsendv1.cpp b/messagebus/src/vespa/messagebus/network/rpcsendv1.cpp index 6b89a278b88..376267b555c 100644 --- a/messagebus/src/vespa/messagebus/network/rpcsendv1.cpp +++ b/messagebus/src/vespa/messagebus/network/rpcsendv1.cpp @@ -35,7 +35,7 @@ RPCSendV1::getReturnSpec() const { void RPCSendV1::build(FRT_ReflectionBuilder & builder) { - builder.DefineMethod(METHOD_NAME, METHOD_PARAMS, METHOD_RETURN, true, FRT_METHOD(RPCSendV1::invoke), this); + builder.DefineMethod(METHOD_NAME, METHOD_PARAMS, METHOD_RETURN, FRT_METHOD(RPCSendV1::invoke), this); builder.MethodDesc("Send a message bus request and get a reply back."); builder.ParamDesc("version", "The version of the message."); builder.ParamDesc("route", "Names of additional hops to visit."); diff --git a/messagebus/src/vespa/messagebus/network/rpcsendv2.cpp b/messagebus/src/vespa/messagebus/network/rpcsendv2.cpp index 4c04549aee1..91a41a6a800 100644 --- a/messagebus/src/vespa/messagebus/network/rpcsendv2.cpp +++ b/messagebus/src/vespa/messagebus/network/rpcsendv2.cpp @@ -59,7 +59,7 @@ bool RPCSendV2::isCompatible(stringref method, stringref request, stringref resp void RPCSendV2::build(FRT_ReflectionBuilder & builder) { - builder.DefineMethod(METHOD_NAME, METHOD_PARAMS, METHOD_RETURN, true, FRT_METHOD(RPCSendV2::invoke), this); + builder.DefineMethod(METHOD_NAME, METHOD_PARAMS, METHOD_RETURN, FRT_METHOD(RPCSendV2::invoke), this); builder.MethodDesc("Send a message bus slime request and get a reply back."); builder.ParamDesc("header_encoding", "0=raw, 6=lz4"); builder.ParamDesc("header_decoded_size", "Uncompressed header blob size"); diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/rpc.cpp b/searchcore/src/vespa/searchcore/fdispatch/common/rpc.cpp index 0d2f6dff983..eaff3b90d78 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/common/rpc.cpp +++ b/searchcore/src/vespa/searchcore/fdispatch/common/rpc.cpp @@ -43,12 +43,12 @@ FastS_RPC::Init(int port, const vespalib::string &myHeartbeatId) void FastS_RPC::RegisterMethods(FRT_ReflectionBuilder *rb) { - rb->DefineMethod("fs.admin.getNodeType", "", "s", true, + rb->DefineMethod("fs.admin.getNodeType", "", "s", FRT_METHOD(FastS_RPC::RPC_GetNodeType), this); rb->MethodDesc("Get string indicating the node type"); rb->ReturnDesc("type", "node type"); //---------------------------------------------------------------// - rb->DefineMethod("fs.admin.getCompileInfo", "", "*", true, + rb->DefineMethod("fs.admin.getCompileInfo", "", "*", FRT_METHOD(FastS_RPC::RPC_GetCompileInfo), this); rb->MethodDesc("Obtain compile info for this node"); rb->ReturnDesc("info", "any number of descriptive strings"); diff --git a/searchcore/src/vespa/searchcore/fdispatch/program/rpc.cpp b/searchcore/src/vespa/searchcore/fdispatch/program/rpc.cpp index 4217ef6d8c9..56301c5e986 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/program/rpc.cpp +++ b/searchcore/src/vespa/searchcore/fdispatch/program/rpc.cpp @@ -9,13 +9,13 @@ FastS_fdispatch_RPC::RegisterMethods(FRT_ReflectionBuilder *rb) { FastS_RPC::RegisterMethods(rb); //------------------------------------------------------------------ - rb->DefineMethod("fs.admin.enableEngine", "s", "i", true, + rb->DefineMethod("fs.admin.enableEngine", "s", "i", FRT_METHOD(FastS_fdispatch_RPC::RPC_EnableEngine), this); rb->MethodDesc("Enable the given engine (clear badness)."); rb->ParamDesc("name", "engine name"); rb->ReturnDesc("count", "number of engines affected"); //------------------------------------------------------------------ - rb->DefineMethod("fs.admin.disableEngine", "s", "i", true, + rb->DefineMethod("fs.admin.disableEngine", "s", "i", FRT_METHOD(FastS_fdispatch_RPC::RPC_DisableEngine), this); rb->MethodDesc("Disable the given engine (mark as admin bad)."); rb->ParamDesc("name", "engine name"); diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp index ab012760762..6e442f472b1 100644 --- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp @@ -127,7 +127,7 @@ RPCHooksBase::initRPC() FRT_ReflectionBuilder rb(_orb.get()); //------------------------------------------------------------------------- - rb.DefineMethod("pandora.rtc.getState", "ii", "SSi", true, + rb.DefineMethod("pandora.rtc.getState", "ii", "SSi", FRT_METHOD(RPCHooksBase::rpc_GetState), this); rb.MethodDesc("Get the current state of node"); rb.ParamDesc("gencnt", "old state generation held by the client"); @@ -136,7 +136,7 @@ RPCHooksBase::initRPC() rb.ReturnDesc("values", "Array of state values"); rb.ReturnDesc("newgen", "New state generation count"); //------------------------------------------------------------------------- - rb.DefineMethod("proton.getStatus", "s", "SSSS", true, + rb.DefineMethod("proton.getStatus", "s", "SSSS", FRT_METHOD(RPCHooksBase::rpc_GetProtonStatus), this); rb.MethodDesc("Get the current state of proton or a proton component"); rb.ParamDesc("component", "Which component to check the status for"); @@ -145,7 +145,7 @@ RPCHooksBase::initRPC() rb.ReturnDesc("internalStates", "Array of internal states "); rb.ReturnDesc("message", "Array of status messages"); //------------------------------------------------------------------------- - rb.DefineMethod("pandora.rtc.getIncrementalState", "i", "SSi", true, + rb.DefineMethod("pandora.rtc.getIncrementalState", "i", "SSi", FRT_METHOD(RPCHooksBase::rpc_getIncrementalState), this); rb.MethodDesc("Get node state changes since last invocation"); rb.ParamDesc("timeout", "How many milliseconds to wait for state update"); @@ -153,26 +153,26 @@ RPCHooksBase::initRPC() rb.ReturnDesc("values", "Array of state values"); rb.ReturnDesc("dummy", "Dummy value to enable code reuse"); //------------------------------------------------------------------------- - rb.DefineMethod("pandora.rtc.shutdown", "", "", true, + rb.DefineMethod("pandora.rtc.shutdown", "", "", FRT_METHOD(RPCHooksBase::rpc_Shutdown), this); rb.MethodDesc("Shut down the rtc application"); //------------------------------------------------------------------------- - rb.DefineMethod("pandora.rtc.die", "", "", true, + rb.DefineMethod("pandora.rtc.die", "", "", FRT_METHOD(RPCHooksBase::rpc_die), this); rb.MethodDesc("Exit the rtc application without cleanup"); //------------------------------------------------------------------------- - rb.DefineMethod("proton.triggerFlush", "", "b", true, + rb.DefineMethod("proton.triggerFlush", "", "b", FRT_METHOD(RPCHooksBase::rpc_triggerFlush), this); rb.MethodDesc("Tell the node to trigger flush ASAP"); rb.ReturnDesc("success", "Whether or not a flush was triggered."); //------------------------------------------------------------------------- - rb.DefineMethod("proton.prepareRestart", "", "b", true, + rb.DefineMethod("proton.prepareRestart", "", "b", FRT_METHOD(RPCHooksBase::rpc_prepareRestart), this); rb.MethodDesc("Tell the node to prepare for a restart by flushing components " "such that TLS replay time + time spent flushing components is as low as possible"); rb.ReturnDesc("success", "Whether or not prepare for restart was triggered."); //------------------------------------------------------------------------- - rb.DefineMethod("proton.getDocsums", "bix", "bix", true, FRT_METHOD(RPCHooksBase::rpc_getDocSums), this); + rb.DefineMethod("proton.getDocsums", "bix", "bix", FRT_METHOD(RPCHooksBase::rpc_getDocSums), this); rb.MethodDesc("Get list of document summaries"); rb.ParamDesc("encoding", "0=raw, 6=lz4"); rb.ParamDesc("uncompressedBlobSize", "Uncompressed blob size"); diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp index aa2b558ea0c..767c8b45e10 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp @@ -11,15 +11,40 @@ LOG_SETUP(".translogclient"); using namespace std::chrono_literals; +VESPA_THREAD_STACK_TAG(translogclient_rpc_callback) + namespace search::transactionlog { namespace { const double NEVER(-1.0); } +namespace { + +struct RpcTask : public vespalib::Executor::Task { + FRT_RPCRequest *req; + std::function<void(FRT_RPCRequest *req)> fun; + RpcTask(FRT_RPCRequest *req_in, std::function<void(FRT_RPCRequest *req)> &&fun_in) + : req(req_in), fun(std::move(fun_in)) {} + void run() override { + fun(req); + req->Return(); + req = nullptr; + } + ~RpcTask() { + if (req != nullptr) { + req->SetError(FRTE_RPC_METHOD_FAILED, "client has been shut down"); + req->Return(); + } + } +}; + +} + using vespalib::LockGuard; TransLogClient::TransLogClient(const vespalib::string & rpcTarget) : + _executor(1, 128 * 1024, translogclient_rpc_callback), _rpcTarget(rpcTarget), _sessions(), _supervisor(std::make_unique<FRT_Supervisor>()), @@ -33,6 +58,7 @@ TransLogClient::TransLogClient(const vespalib::string & rpcTarget) : TransLogClient::~TransLogClient() { disconnect(); + _executor.shutdown().sync(); _supervisor->ShutDown(true); } @@ -139,7 +165,7 @@ void TransLogClient::exportRPC(FRT_Supervisor & supervisor) FRT_ReflectionBuilder rb( & supervisor); //-- Visit Callbacks ----------------------------------------------------------- - rb.DefineMethod("visitCallback", "six", "i", false, FRT_METHOD(TransLogClient::visitCallbackRPC), this); + rb.DefineMethod("visitCallback", "six", "i", FRT_METHOD(TransLogClient::visitCallbackRPC_hook), this); rb.MethodDesc("Will return data asked from a subscriber/visitor."); rb.ParamDesc("name", "The name of the domain."); rb.ParamDesc("session", "Session handle."); @@ -147,14 +173,15 @@ void TransLogClient::exportRPC(FRT_Supervisor & supervisor) rb.ReturnDesc("result", "A resultcode(int) of the operation. Non zero number indicates error."); //-- Visit Callbacks ----------------------------------------------------------- - rb.DefineMethod("eofCallback", "si", "i", false, FRT_METHOD(TransLogClient::eofCallbackRPC), this); + rb.DefineMethod("eofCallback", "si", "i", FRT_METHOD(TransLogClient::eofCallbackRPC_hook), this); rb.MethodDesc("Will tell you that you are done with the visitor."); rb.ParamDesc("name", "The name of the domain."); rb.ParamDesc("session", "Session handle."); rb.ReturnDesc("result", "A resultcode(int) of the operation. Non zero number indicates error."); } -void TransLogClient::visitCallbackRPC(FRT_RPCRequest *req) + +void TransLogClient::do_visitCallbackRPC(FRT_RPCRequest *req) { uint32_t retval(uint32_t(-1)); FRT_Values & params = *req->GetParams(); @@ -171,7 +198,7 @@ void TransLogClient::visitCallbackRPC(FRT_RPCRequest *req) LOG(debug, "visitCallback(%s, %d)=%d done", domainName, sessionId, retval); } -void TransLogClient::eofCallbackRPC(FRT_RPCRequest *req) +void TransLogClient::do_eofCallbackRPC(FRT_RPCRequest *req) { uint32_t retval(uint32_t(-1)); FRT_Values & params = *req->GetParams(); @@ -188,6 +215,16 @@ void TransLogClient::eofCallbackRPC(FRT_RPCRequest *req) LOG(debug, "eofCallback(%s, %d)=%d done", domainName, sessionId, retval); } +void TransLogClient::visitCallbackRPC_hook(FRT_RPCRequest *req) +{ + _executor.execute(std::make_unique<RpcTask>(req->Detach(), [this](FRT_RPCRequest *x){ do_visitCallbackRPC(x); })); +} + +void TransLogClient::eofCallbackRPC_hook(FRT_RPCRequest *req) +{ + _executor.execute(std::make_unique<RpcTask>(req->Detach(), [this](FRT_RPCRequest *x){ do_eofCallbackRPC(x); })); +} + TransLogClient::Session::Session(const vespalib::string & domain, TransLogClient & tlc) : _tlc(tlc), diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogclient.h b/searchlib/src/vespa/searchlib/transactionlog/translogclient.h index 87901890673..267d6e3b0ed 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogclient.h +++ b/searchlib/src/vespa/searchlib/transactionlog/translogclient.h @@ -5,6 +5,7 @@ #include <vespa/document/util/bytebuffer.h> #include <vespa/vespalib/util/sync.h> #include <vespa/vespalib/util/buffer.h> +#include <vespa/vespalib/util/threadstackexecutor.h> #include <vespa/fnet/frt/invokable.h> #include <map> #include <vector> @@ -96,8 +97,10 @@ public: const vespalib::string &getRPCTarget() const { return _rpcTarget; } private: void exportRPC(FRT_Supervisor & supervisor); - void visitCallbackRPC(FRT_RPCRequest *req); - void eofCallbackRPC(FRT_RPCRequest *req); + void do_visitCallbackRPC(FRT_RPCRequest *req); + void do_eofCallbackRPC(FRT_RPCRequest *req); + void visitCallbackRPC_hook(FRT_RPCRequest *req); + void eofCallbackRPC_hook(FRT_RPCRequest *req); int32_t rpc(FRT_RPCRequest * req); Session * findSession(const vespalib::string & domain, int sessionId); @@ -114,6 +117,7 @@ private: typedef std::map< SessionKey, Session * > SessionMap; + vespalib::ThreadStackExecutor _executor; vespalib::string _rpcTarget; SessionMap _sessions; //Brute force lock for subscriptions. For multithread safety. diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp index 65bb682a389..dd6b63f9241 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp @@ -244,32 +244,32 @@ void TransLogServer::exportRPC(FRT_Supervisor & supervisor) FRT_ReflectionBuilder rb( & supervisor); //-- Create Domain ----------------------------------------------------------- - rb.DefineMethod("createDomain", "s", "i", true, FRT_METHOD(TransLogServer::relayToThreadRPC), this); + rb.DefineMethod("createDomain", "s", "i", FRT_METHOD(TransLogServer::relayToThreadRPC), this); rb.MethodDesc("Create a new domain."); rb.ParamDesc("name", "The name of the domain."); rb.ReturnDesc("handle", "A handle(int) to the domain. Negative number indicates error."); //-- Delete Domain ----------------------------------------------------------- - rb.DefineMethod("deleteDomain", "s", "is", true, FRT_METHOD(TransLogServer::relayToThreadRPC), this); + rb.DefineMethod("deleteDomain", "s", "is", FRT_METHOD(TransLogServer::relayToThreadRPC), this); rb.MethodDesc("Create a new domain."); rb.ParamDesc("name", "The name of the domain."); rb.ReturnDesc("retval", "0 on success. Negative number indicates error."); rb.ReturnDesc("errormsg", "Message describing the error, if any."); //-- Open Domain ----------------------------------------------------------- - rb.DefineMethod("openDomain", "s", "i", true, FRT_METHOD(TransLogServer::relayToThreadRPC), this); + rb.DefineMethod("openDomain", "s", "i", FRT_METHOD(TransLogServer::relayToThreadRPC), this); rb.MethodDesc("Open an existing domain."); rb.ParamDesc("name", "The name of the domain."); rb.ReturnDesc("handle", "A handle(int) to the domain. Negative number indicates error."); //-- List Domains ----------------------------------------------------------- - rb.DefineMethod("listDomains", "", "is", true, FRT_METHOD(TransLogServer::relayToThreadRPC), this); + rb.DefineMethod("listDomains", "", "is", FRT_METHOD(TransLogServer::relayToThreadRPC), this); rb.MethodDesc("Will return a list of all the domains."); rb.ReturnDesc("result", "A resultcode(int) of the operation. Negative number indicates error."); rb.ReturnDesc("domains", "List of all the domains in a newline separated string"); //-- Domain Status ----------------------------------------------------------- - rb.DefineMethod("domainStatus", "s", "illl", true, FRT_METHOD(TransLogServer::relayToThreadRPC), this); + rb.DefineMethod("domainStatus", "s", "illl", FRT_METHOD(TransLogServer::relayToThreadRPC), this); rb.MethodDesc("This will return key status information about the domain."); rb.ParamDesc("name", "The name of the domain."); rb.ReturnDesc("result", "A resultcode(int) of the operation. Negative number indicates error."); @@ -278,7 +278,7 @@ void TransLogServer::exportRPC(FRT_Supervisor & supervisor) rb.ReturnDesc("size", "Number of elements in the log."); //-- Domain Commit ----------------------------------------------------------- - rb.DefineMethod("domainCommit", "sx", "is", true, FRT_METHOD(TransLogServer::relayToThreadRPC), this); + rb.DefineMethod("domainCommit", "sx", "is", FRT_METHOD(TransLogServer::relayToThreadRPC), this); rb.MethodDesc("Will commit the data to the log."); rb.ParamDesc("name", "The name of the domain."); rb.ParamDesc("packet", "The data to commit to the domain."); @@ -286,14 +286,14 @@ void TransLogServer::exportRPC(FRT_Supervisor & supervisor) rb.ReturnDesc("message", "A textual description of the result code."); //-- Domain Prune ----------------------------------------------------------- - rb.DefineMethod("domainPrune", "sl", "i", true, FRT_METHOD(TransLogServer::relayToThreadRPC), this); + rb.DefineMethod("domainPrune", "sl", "i", FRT_METHOD(TransLogServer::relayToThreadRPC), this); rb.MethodDesc("Will erase all operations prior to the serial number."); rb.ParamDesc("name", "The name of the domain."); rb.ParamDesc("to", "Will erase all up and including."); rb.ReturnDesc("result", "A resultcode(int) of the operation. Negative number indicates error."); //-- Domain Visit ----------------------------------------------------------- - rb.DefineMethod("domainVisit", "sll", "i", true, FRT_METHOD(TransLogServer::relayToThreadRPC), this); + rb.DefineMethod("domainVisit", "sll", "i", FRT_METHOD(TransLogServer::relayToThreadRPC), this); rb.MethodDesc("This will create a visitor that return all operations in the range."); rb.ParamDesc("name", "The name of the domain."); rb.ParamDesc("from", "Will return all entries following(not including) <from>."); @@ -301,21 +301,21 @@ void TransLogServer::exportRPC(FRT_Supervisor & supervisor) rb.ReturnDesc("result", "A resultcode(int) of the operation. Negative number indicates error. Positive number is the sessionid"); //-- Domain Session Run ----------------------------------------------------------- - rb.DefineMethod("domainSessionRun", "si", "i", true, FRT_METHOD(TransLogServer::relayToThreadRPC), this); + rb.DefineMethod("domainSessionRun", "si", "i", FRT_METHOD(TransLogServer::relayToThreadRPC), this); rb.MethodDesc("This will start the session thread."); rb.ParamDesc("name", "The name of the domain."); rb.ParamDesc("sessionid", "The session identifier."); rb.ReturnDesc("result", "A resultcode(int) of the operation. Negative number indicates error."); //-- Domain Session Close ----------------------------------------------------------- - rb.DefineMethod("domainSessionClose", "si", "i", true, FRT_METHOD(TransLogServer::relayToThreadRPC), this); + rb.DefineMethod("domainSessionClose", "si", "i", FRT_METHOD(TransLogServer::relayToThreadRPC), this); rb.MethodDesc("This will close the session."); rb.ParamDesc("name", "The name of the domain."); rb.ParamDesc("sessionid", "The session identifier."); rb.ReturnDesc("result", "A resultcode(int) of the operation. Negative number indicates error. 1 means busy -> retry. 0 is OK."); //-- Domain Sync -- - rb.DefineMethod("domainSync", "sl", "il", true, FRT_METHOD(TransLogServer::relayToThreadRPC), this); + rb.DefineMethod("domainSync", "sl", "il", FRT_METHOD(TransLogServer::relayToThreadRPC), this); rb.MethodDesc("Sync domain to given entry"); rb.ParamDesc("name", "The name of the domain."); rb.ParamDesc("syncto", "Entry to sync to"); diff --git a/slobrok/src/tests/mirrorapi/mirrorapi.cpp b/slobrok/src/tests/mirrorapi/mirrorapi.cpp index 0550bf51b0c..f77dfd80986 100644 --- a/slobrok/src/tests/mirrorapi/mirrorapi.cpp +++ b/slobrok/src/tests/mirrorapi/mirrorapi.cpp @@ -41,7 +41,7 @@ Server::Server(std::string name, int port, std::string slobrokSpec) { FRT_ReflectionBuilder rb(&_orb); //--------------------------------------------------------------------- - rb.DefineMethod("slobrok.callback.listNamesServed", "", "S", true, + rb.DefineMethod("slobrok.callback.listNamesServed", "", "S", FRT_METHOD(Server::rpc_listNamesServed), this); rb.MethodDesc("Look up a rpcserver"); rb.ReturnDesc("names", "The rpcserver names on this server"); diff --git a/slobrok/src/tests/oldapi/old.cpp b/slobrok/src/tests/oldapi/old.cpp index 77bca6dfe90..42cec186a08 100644 --- a/slobrok/src/tests/oldapi/old.cpp +++ b/slobrok/src/tests/oldapi/old.cpp @@ -39,7 +39,7 @@ Server::Server(std::string name, int port, std::string slobrokSpec) { FRT_ReflectionBuilder rb(&_orb); //--------------------------------------------------------------------- - rb.DefineMethod("slobrok.callback.listNamesServed", "", "S", true, + rb.DefineMethod("slobrok.callback.listNamesServed", "", "S", FRT_METHOD(Server::rpc_listNamesServed), this); rb.MethodDesc("Look up a rpcserver"); rb.ReturnDesc("names", "The rpcserver names on this server"); diff --git a/slobrok/src/tests/standalone/standalone.cpp b/slobrok/src/tests/standalone/standalone.cpp index 63f8b1d2c59..136f8125c8b 100644 --- a/slobrok/src/tests/standalone/standalone.cpp +++ b/slobrok/src/tests/standalone/standalone.cpp @@ -26,7 +26,7 @@ Server::Server(std::string name, int port) { FRT_ReflectionBuilder rb(&_orb); //--------------------------------------------------------------------- - rb.DefineMethod("slobrok.callback.listNamesServed", "", "S", true, + rb.DefineMethod("slobrok.callback.listNamesServed", "", "S", FRT_METHOD(Server::rpc_listNamesServed), this); rb.MethodDesc("Look up a rpcserver"); rb.ReturnDesc("names", "The rpcserver names on this server"); diff --git a/slobrok/src/tests/startsome/tstdst.cpp b/slobrok/src/tests/startsome/tstdst.cpp index 44b42e1ff83..4723b3819d7 100644 --- a/slobrok/src/tests/startsome/tstdst.cpp +++ b/slobrok/src/tests/startsome/tstdst.cpp @@ -87,12 +87,12 @@ RPCHooks::initRPC(FRT_Supervisor *supervisor) FRT_ReflectionBuilder rb(supervisor); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.callback.listNamesServed", "", "S", true, + rb.DefineMethod("slobrok.callback.listNamesServed", "", "S", FRT_METHOD(RPCHooks::rpc_listNamesServed), this); rb.MethodDesc("Look up a rpcserver"); rb.ReturnDesc("names", "The rpcserver names on this server"); //------------------------------------------------------------------------- - rb.DefineMethod("system.stop", "", "", true, + rb.DefineMethod("system.stop", "", "", FRT_METHOD(RPCHooks::rpc_stop), this); rb.MethodDesc("Shut down the application"); //------------------------------------------------------------------------- diff --git a/slobrok/src/vespa/slobrok/sbregister.cpp b/slobrok/src/vespa/slobrok/sbregister.cpp index 8f8e42a39aa..a1346feeece 100644 --- a/slobrok/src/vespa/slobrok/sbregister.cpp +++ b/slobrok/src/vespa/slobrok/sbregister.cpp @@ -277,12 +277,12 @@ RegisterAPI::RPCHooks::RPCHooks(RegisterAPI &owner) { FRT_ReflectionBuilder rb(&_owner._orb); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.callback.listNamesServed", "", "S", true, + rb.DefineMethod("slobrok.callback.listNamesServed", "", "S", FRT_METHOD(RPCHooks::rpc_listNamesServed), this); rb.MethodDesc("List rpcserver names"); rb.ReturnDesc("names", "The rpcserver names this server wants to serve"); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.callback.notifyUnregistered", "s", "", true, + rb.DefineMethod("slobrok.callback.notifyUnregistered", "s", "", FRT_METHOD(RPCHooks::rpc_notifyUnregistered), this); rb.MethodDesc("Notify a server about removed registration"); rb.ParamDesc("name", "RpcServer name"); diff --git a/slobrok/src/vespa/slobrok/server/rpchooks.cpp b/slobrok/src/vespa/slobrok/server/rpchooks.cpp index 33cc10937df..82e30a309a1 100644 --- a/slobrok/src/vespa/slobrok/server/rpchooks.cpp +++ b/slobrok/src/vespa/slobrok/server/rpchooks.cpp @@ -81,39 +81,39 @@ RPCHooks::initRPC(FRT_Supervisor *supervisor) FRT_ReflectionBuilder rb(supervisor); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.system.resume", "", "", true, + rb.DefineMethod("slobrok.system.resume", "", "", FRT_METHOD(RPCHooks::rpc_resume), this); rb.MethodDesc("Enable something - currently NOP"); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.system.suspend", "", "", true, + rb.DefineMethod("slobrok.system.suspend", "", "", FRT_METHOD(RPCHooks::rpc_suspend), this); rb.MethodDesc("Disable something - currently NOP"); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.system.version", "", "s", true, + rb.DefineMethod("slobrok.system.version", "", "s", FRT_METHOD(RPCHooks::rpc_version), this); rb.MethodDesc("Get location broker version"); rb.ReturnDesc("version", "version string"); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.system.stop", "", "", true, + rb.DefineMethod("slobrok.system.stop", "", "", FRT_METHOD(RPCHooks::rpc_stop), this); rb.MethodDesc("Shut down the location broker application"); //------------------------------------------------------------------------- //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.internal.listManagedRpcServers", "", "SS", true, + rb.DefineMethod("slobrok.internal.listManagedRpcServers", "", "SS", FRT_METHOD(RPCHooks::rpc_listManagedRpcServers), this); rb.MethodDesc("List all rpcservers managed by this location broker"); rb.ReturnDesc("names", "Managed rpcserver names"); rb.ReturnDesc("specs", "The connection specifications (in same order)"); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.internal.lookupManaged", "s", "ss", true, + rb.DefineMethod("slobrok.internal.lookupManaged", "s", "ss", FRT_METHOD(RPCHooks::rpc_lookupManaged), this); rb.MethodDesc("Lookup a specific rpcserver managed by this location broker"); rb.ParamDesc("name", "Name of rpc server"); rb.ReturnDesc("name", "Name of rpc server"); rb.ReturnDesc("spec", "The connection specification"); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.internal.wantAdd", "sss", "is", true, + rb.DefineMethod("slobrok.internal.wantAdd", "sss", "is", FRT_METHOD(RPCHooks::rpc_wantAdd), this); rb.MethodDesc("remote location broker wants to add a rpcserver"); rb.ParamDesc("slobrok", "Name of remote location broker"); @@ -122,7 +122,7 @@ RPCHooks::initRPC(FRT_Supervisor *supervisor) rb.ReturnDesc("denied", "non-zero if request was denied"); rb.ReturnDesc("reason", "reason for denial"); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.internal.doAdd", "sss", "is", true, + rb.DefineMethod("slobrok.internal.doAdd", "sss", "is", FRT_METHOD(RPCHooks::rpc_doAdd), this); rb.MethodDesc("add rpcserver managed by remote location broker"); rb.ParamDesc("slobrok", "Name of remote location broker"); @@ -131,7 +131,7 @@ RPCHooks::initRPC(FRT_Supervisor *supervisor) rb.ReturnDesc("denied", "non-zero if request was denied"); rb.ReturnDesc("reason", "reason for denial"); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.internal.doRemove", "sss", "is", true, + rb.DefineMethod("slobrok.internal.doRemove", "sss", "is", FRT_METHOD(RPCHooks::rpc_doRemove), this); rb.MethodDesc("remove rpcserver managed by remote location broker"); rb.ParamDesc("slobrok", "Name of remote location broker"); @@ -142,31 +142,31 @@ RPCHooks::initRPC(FRT_Supervisor *supervisor) //------------------------------------------------------------------------- //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.callback.listNamesServed", "", "S", true, + rb.DefineMethod("slobrok.callback.listNamesServed", "", "S", FRT_METHOD(RPCHooks::rpc_listNamesServed), this); rb.MethodDesc("List rpcservers served"); rb.ReturnDesc("names", "The rpcserver names this server wants to serve"); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.callback.notifyUnregistered", "s", "", true, + rb.DefineMethod("slobrok.callback.notifyUnregistered", "s", "", FRT_METHOD(RPCHooks::rpc_notifyUnregistered), this); rb.MethodDesc("Notify a server about removed registration"); rb.ParamDesc("name", "NamedService name"); //------------------------------------------------------------------------- //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.admin.removePeer", "ss", "", true, + rb.DefineMethod("slobrok.admin.removePeer", "ss", "", FRT_METHOD(RPCHooks::rpc_removePeer), this); rb.MethodDesc("stop syncing with other location broker"); rb.ParamDesc("slobrok", "NamedService name of remote location broker"); rb.ParamDesc("spec", "Connection specification of remote location broker"); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.admin.addPeer", "ss", "", true, + rb.DefineMethod("slobrok.admin.addPeer", "ss", "", FRT_METHOD(RPCHooks::rpc_addPeer), this); rb.MethodDesc("sync our information with other location broker"); rb.ParamDesc("slobrok", "NamedService name of remote location broker"); rb.ParamDesc("spec", "Connection specification of remote location broker"); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.admin.listAllRpcServers", "", "SSS", true, + rb.DefineMethod("slobrok.admin.listAllRpcServers", "", "SSS", FRT_METHOD(RPCHooks::rpc_listAllRpcServers), this); rb.MethodDesc("List all known rpcservers"); rb.ReturnDesc("names", "NamedService names"); @@ -175,13 +175,13 @@ RPCHooks::initRPC(FRT_Supervisor *supervisor) //------------------------------------------------------------------------- //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.unregisterRpcServer", "ss", "", true, + rb.DefineMethod("slobrok.unregisterRpcServer", "ss", "", FRT_METHOD(RPCHooks::rpc_unregisterRpcServer), this); rb.MethodDesc("Unregister a rpcserver"); rb.ParamDesc("name", "NamedService name"); rb.ParamDesc("spec", "The connection specification"); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.registerRpcServer", "ss", "", true, + rb.DefineMethod("slobrok.registerRpcServer", "ss", "", FRT_METHOD(RPCHooks::rpc_registerRpcServer), this); rb.MethodDesc("Register a rpcserver"); rb.ParamDesc("name", "NamedService name"); @@ -189,7 +189,7 @@ RPCHooks::initRPC(FRT_Supervisor *supervisor) //------------------------------------------------------------------------- //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.mirror.fetch", "ii", "SSi", true, + rb.DefineMethod("slobrok.mirror.fetch", "ii", "SSi", FRT_METHOD(RPCHooks::rpc_mirrorFetch), this); rb.MethodDesc("Fetch or update mirror of name to spec map"); rb.ParamDesc("gencnt", "generation already known by client"); @@ -199,7 +199,7 @@ RPCHooks::initRPC(FRT_Supervisor *supervisor) rb.ReturnDesc("specs", "Array of connection specifications (same order)"); rb.ReturnDesc("newgen", "Generation count for new version of the map"); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.incremental.fetch", "ii", "iSSSi", true, + rb.DefineMethod("slobrok.incremental.fetch", "ii", "iSSSi", FRT_METHOD(RPCHooks::rpc_incrementalFetch), this); rb.MethodDesc("Fetch or update mirror of name to spec map"); rb.ParamDesc("gencnt", "generation already known by client"); @@ -212,7 +212,7 @@ RPCHooks::initRPC(FRT_Supervisor *supervisor) rb.ReturnDesc("specs", "Array of connection specifications (same order)"); rb.ReturnDesc("newgen", "Generation count for new version of the map"); //------------------------------------------------------------------------- - rb.DefineMethod("slobrok.lookupRpcServer", "s", "SS", true, + rb.DefineMethod("slobrok.lookupRpcServer", "s", "SS", FRT_METHOD(RPCHooks::rpc_lookupRpcServer), this); rb.MethodDesc("Look up rpcservers"); rb.ParamDesc("pattern", "The pattern of the rpcservers to lookup.\n" diff --git a/storage/src/vespa/storage/storageserver/fnetlistener.cpp b/storage/src/vespa/storage/storageserver/fnetlistener.cpp index 1a72190b2a6..e31bded772c 100644 --- a/storage/src/vespa/storage/storageserver/fnetlistener.cpp +++ b/storage/src/vespa/storage/storageserver/fnetlistener.cpp @@ -65,7 +65,7 @@ FNetListener::initRPC() { FRT_ReflectionBuilder rb(_orb.get()); - rb.DefineMethod("getnodestate3", "sii", "ss", true, FRT_METHOD(FNetListener::RPC_getNodeState2), this); + rb.DefineMethod("getnodestate3", "sii", "ss", FRT_METHOD(FNetListener::RPC_getNodeState2), this); rb.MethodDesc("Get state of this node"); rb.ParamDesc("nodestate", "Expected state of given node. If correct, the " "request will be queued on target until it changes. To not give " @@ -74,7 +74,7 @@ FNetListener::initRPC() rb.ReturnDesc("nodestate", "State string for this node"); rb.ReturnDesc("hostinfo", "Information about host this node is running on"); //------------------------------------------------------------------------- - rb.DefineMethod("getnodestate2", "si", "s", true, FRT_METHOD(FNetListener::RPC_getNodeState2), this); + rb.DefineMethod("getnodestate2", "si", "s", FRT_METHOD(FNetListener::RPC_getNodeState2), this); rb.MethodDesc("Get state of this node"); rb.ParamDesc("nodestate", "Expected state of given node. If correct, the " "request will be queued on target until it changes. To not give " @@ -82,17 +82,17 @@ FNetListener::initRPC() rb.ParamDesc("timeout", "Timeout of message in milliseconds, set by the state requester"); rb.ReturnDesc("nodestate", "State string for this node"); //------------------------------------------------------------------------- - rb.DefineMethod("setsystemstate2", "s", "", true, FRT_METHOD(FNetListener::RPC_setSystemState2), this); + rb.DefineMethod("setsystemstate2", "s", "", FRT_METHOD(FNetListener::RPC_setSystemState2), this); rb.MethodDesc("Set systemstate on this node"); rb.ParamDesc("systemstate", "New systemstate to set"); //------------------------------------------------------------------------- - rb.DefineMethod("setdistributionstates", "bix", "", true, FRT_METHOD(FNetListener::RPC_setDistributionStates), this); + rb.DefineMethod("setdistributionstates", "bix", "", FRT_METHOD(FNetListener::RPC_setDistributionStates), this); rb.MethodDesc("Set distribution states for cluster and bucket spaces"); rb.ParamDesc("compressionType", "Compression type for payload"); rb.ParamDesc("uncompressedSize", "Uncompressed size for payload"); rb.ParamDesc("payload", "Binary Slime format payload"); //------------------------------------------------------------------------- - rb.DefineMethod("getcurrenttime", "", "lis", true, FRT_METHOD(FNetListener::RPC_getCurrentTime), this); + rb.DefineMethod("getcurrenttime", "", "lis", FRT_METHOD(FNetListener::RPC_getCurrentTime), this); rb.MethodDesc("Get current time on this node"); rb.ReturnDesc("seconds", "Current time in seconds since epoch"); rb.ReturnDesc("nanoseconds", "additional nanoseconds since epoch"); diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h index 9679e6379f5..6e8fa368df7 100644 --- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h +++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h @@ -23,10 +23,10 @@ namespace thread { class ThreadInit; } // init function when creating an executor to inject a frame with the // given name into the stack of all worker threads. -#define VESPA_THREAD_STACK_TAG(name) \ - int name(Runnable &worker) { \ - worker.run(); \ - return 1; \ +#define VESPA_THREAD_STACK_TAG(name) \ + int name(::vespalib::Runnable &worker) { \ + worker.run(); \ + return 1; \ } /** |