int MeshTest::svc_i(void* arg) { printf("Starting RPC test...\n"); RPCService* s = new RPCService(); UUIDPtr sid; s->getSID(sid); UUIDPtr iid; ServiceParams* params = 0; if (m_ft) { FTServiceParamsPtr ftParams(new FTServiceParams(m_replicasNo, 0)); params = new ServiceParams(sid, ftParams); } else { params = new ServiceParams(sid); } ServiceParamsPtr paramsPtr(params); try { UUIDPtr deployUUIDD; m_runtime->startService(sid, paramsPtr, iid, deployUUIDD); ClientParamsPtr cp(new ClientParams(QoS::HRT, CPUQoS::MAX_RT_PRIO)); OverlayInterface* overlay = m_runtime->getOverlayInterface(); //overlay->getDiscovery()->executeQuery() return 0; } catch (ServiceException& se) { printf("MeshTest:: failed to bootstrap rpc service\n"); return -1; } return -1; }
void MeshTest::performFaultInPrimary(UUIDPtr& primaryUUID) { RPCService s; UUIDPtr sid; s.getSID(sid); UUIDPtr iid; ServiceParams* params = 0; params = new ServiceParams(sid); //NO-FT //ServiceParams* params = new ServiceParams(sid); ServiceParamsPtr paramsPtr(params); ServiceClient* c = 0; RPCServiceClient* rpcClient = 0; RPCRuntimeManagerObjectClient* rpcManagerObjectClient = 0; try { m_runtime->startService(sid, primaryUUID, paramsPtr, iid); ClientParamsPtr cp(new ClientParams(QoS::HRT, CPUQoS::MAX_RT_PRIO)); c = m_runtime->getClient(sid, iid, cp); rpcClient = static_cast<RPCServiceClient*> (c); rpcManagerObjectClient = new RPCRuntimeManagerObjectClient(rpcClient); rpcManagerObjectClient->hardFault(); } catch (ServiceException& se) { printf("failed to inject fault\n"); } if (rpcManagerObjectClient != 0) { delete rpcManagerObjectClient; } }
ServerFunctionBase *ServerConnection::findFunction(color_ostream &out, const std::string &plugin, const std::string &name) { RPCService *svc; if (plugin.empty()) svc = core_service; else { svc = plugin_services[plugin]; if (!svc) { Plugin *plug = Core::getInstance().plug_mgr->getPluginByName(plugin); if (!plug) { out.printerr("No such plugin: %s\n", plugin.c_str()); return NULL; } svc = plug->rpc_connect(out); if (!svc) { out.printerr("Plugin %s doesn't export any RPC methods.\n", plugin.c_str()); return NULL; } svc->finalize(this, &functions); plugin_services[plugin] = svc; } } return svc->getFunction(name); }
DFhackCExport RPCService *plugin_rpcconnect(color_ostream &) { RPCService *svc = new RPCService(); svc->addFunction("RenameSquad", RenameSquad); svc->addFunction("RenameUnit", RenameUnit); return svc; }
DFhackCExport RPCService *plugin_rpcconnect(color_ostream &) { RPCService *svc = new RPCService(); svc->addFunction("GetEmbarkTile", GetEmbarkTile); svc->addFunction("GetEmbarkInfo", GetEmbarkInfo); svc->addFunction("GetRawNames", GetRawNames); return svc; }