Skip to content

Commit ece2f12

Browse files
committed
add agencyID to psi/mpc serviceName
1 parent feb754b commit ece2f12

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

cpp/wedpr-helper/ppc-utilities/Utilities.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ inline std::string generateUUID()
6464
static thread_local auto uuid_gen = boost::uuids::basic_random_generator<std::random_device>();
6565
return boost::uuids::to_string(uuid_gen());
6666
}
67+
68+
inline std::string getServiceName(std::string const& agencyID, std::string const& serviceID)
69+
{
70+
return agencyID + "_" + serviceID;
71+
}
6772
template <typename T>
6873
inline std::string printVector(T const& list)
6974
{

cpp/wedpr-initializer/Initializer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "ppc-psi/src/labeled-psi/LabeledPSIFactory.h"
4141
#include "ppc-psi/src/ra2018-psi/RA2018PSIFactory.h"
4242
#include "ppc-tools/src/config/PPCConfig.h"
43+
#include "wedpr-helper/ppc-utilities/Utilities.h"
4344
#include <tbb/tbb.h>
4445
#include <thread>
4546

@@ -86,8 +87,9 @@ void Initializer::init(ppc::gateway::IGateway::Ptr const& gateway)
8687
TransportBuilder transportBuilder;
8788
// register the serviceInfo
8889
auto serviceConfig = m_serviceConfigBuilder.buildServiceConfig();
89-
auto entryPoint =
90-
m_serviceConfigBuilder.buildEntryPoint(PSI_SERVICE_TYPE, m_config->accessEntrypoint());
90+
auto entryPoint = m_serviceConfigBuilder.buildEntryPoint(
91+
getServiceName(m_config->agencyID(), PSI_SERVICE_TYPE), m_config->accessEntrypoint());
92+
9193
serviceConfig.addEntryPoint(entryPoint);
9294
auto serviceMeta = serviceConfig.encode();
9395
m_config->frontConfig()->setMeta(serviceMeta);

cpp/wedpr-main/mpc-node/MPCInitializer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void MPCInitializer::init(std::string const& _configPath)
6161
auto threadPool = std::make_shared<bcos::ThreadPool>("mpc-pool", threadPoolSize);
6262

6363
INIT_LOG(INFO) << LOG_DESC("init the mpc threadpool")
64-
<< LOG_KV("threadPoolSize", threadPoolSize);
64+
<< LOG_KV("threadPoolSize", threadPoolSize);
6565

6666
auto mpcService = std::make_shared<MPCService>();
6767
mpcService->setMPCConfig(mpcConfig);
@@ -71,11 +71,11 @@ void MPCInitializer::init(std::string const& _configPath)
7171
m_rpc->registerHandler("run", std::bind(&MPCService::runMpcRpc, mpcService,
7272
std::placeholders::_1, std::placeholders::_2));
7373
m_rpc->registerHandler("asyncRun", std::bind(&MPCService::asyncRunMpcRpc, mpcService,
74-
std::placeholders::_1, std::placeholders::_2));
74+
std::placeholders::_1, std::placeholders::_2));
7575
m_rpc->registerHandler("kill", std::bind(&MPCService::killMpcRpc, mpcService,
7676
std::placeholders::_1, std::placeholders::_2));
7777
m_rpc->registerHandler("query", std::bind(&MPCService::queryMpcRpc, mpcService,
78-
std::placeholders::_1, std::placeholders::_2));
78+
std::placeholders::_1, std::placeholders::_2));
7979
INIT_LOG(INFO) << LOG_DESC("init the mpc rpc success");
8080
// init the transport
8181
initTransport(pt);
@@ -89,8 +89,8 @@ void MPCInitializer::initTransport(boost::property_tree::ptree const& property)
8989

9090
// add the service meta
9191
ServiceConfigBuilder serviceConfigBuilder;
92-
auto entryPoint =
93-
serviceConfigBuilder.buildEntryPoint(MPC_SERVICE_TYPE, m_config->accessEntrypoint());
92+
auto entryPoint = serviceConfigBuilder.buildEntryPoint(
93+
getServiceName(m_config->agencyID(), MPC_SERVICE_TYPE), m_config->accessEntrypoint());
9494
auto serviceConfig = serviceConfigBuilder.buildServiceConfig();
9595
serviceConfig.addEntryPoint(entryPoint);
9696
auto serviceMeta = serviceConfig.encode();

0 commit comments

Comments
 (0)