Skip to content

Commit

Permalink
add agencyID to psi/mpc serviceName
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull committed Dec 4, 2024
1 parent feb754b commit ece2f12
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
5 changes: 5 additions & 0 deletions cpp/wedpr-helper/ppc-utilities/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ inline std::string generateUUID()
static thread_local auto uuid_gen = boost::uuids::basic_random_generator<std::random_device>();
return boost::uuids::to_string(uuid_gen());
}

inline std::string getServiceName(std::string const& agencyID, std::string const& serviceID)
{
return agencyID + "_" + serviceID;
}
template <typename T>
inline std::string printVector(T const& list)
{
Expand Down
6 changes: 4 additions & 2 deletions cpp/wedpr-initializer/Initializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "ppc-psi/src/labeled-psi/LabeledPSIFactory.h"
#include "ppc-psi/src/ra2018-psi/RA2018PSIFactory.h"
#include "ppc-tools/src/config/PPCConfig.h"
#include "wedpr-helper/ppc-utilities/Utilities.h"
#include <tbb/tbb.h>
#include <thread>

Expand Down Expand Up @@ -86,8 +87,9 @@ void Initializer::init(ppc::gateway::IGateway::Ptr const& gateway)
TransportBuilder transportBuilder;
// register the serviceInfo
auto serviceConfig = m_serviceConfigBuilder.buildServiceConfig();
auto entryPoint =
m_serviceConfigBuilder.buildEntryPoint(PSI_SERVICE_TYPE, m_config->accessEntrypoint());
auto entryPoint = m_serviceConfigBuilder.buildEntryPoint(
getServiceName(m_config->agencyID(), PSI_SERVICE_TYPE), m_config->accessEntrypoint());

serviceConfig.addEntryPoint(entryPoint);
auto serviceMeta = serviceConfig.encode();
m_config->frontConfig()->setMeta(serviceMeta);
Expand Down
10 changes: 5 additions & 5 deletions cpp/wedpr-main/mpc-node/MPCInitializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void MPCInitializer::init(std::string const& _configPath)
auto threadPool = std::make_shared<bcos::ThreadPool>("mpc-pool", threadPoolSize);

INIT_LOG(INFO) << LOG_DESC("init the mpc threadpool")
<< LOG_KV("threadPoolSize", threadPoolSize);
<< LOG_KV("threadPoolSize", threadPoolSize);

auto mpcService = std::make_shared<MPCService>();
mpcService->setMPCConfig(mpcConfig);
Expand All @@ -71,11 +71,11 @@ void MPCInitializer::init(std::string const& _configPath)
m_rpc->registerHandler("run", std::bind(&MPCService::runMpcRpc, mpcService,
std::placeholders::_1, std::placeholders::_2));
m_rpc->registerHandler("asyncRun", std::bind(&MPCService::asyncRunMpcRpc, mpcService,
std::placeholders::_1, std::placeholders::_2));
std::placeholders::_1, std::placeholders::_2));
m_rpc->registerHandler("kill", std::bind(&MPCService::killMpcRpc, mpcService,
std::placeholders::_1, std::placeholders::_2));
m_rpc->registerHandler("query", std::bind(&MPCService::queryMpcRpc, mpcService,
std::placeholders::_1, std::placeholders::_2));
std::placeholders::_1, std::placeholders::_2));
INIT_LOG(INFO) << LOG_DESC("init the mpc rpc success");
// init the transport
initTransport(pt);
Expand All @@ -89,8 +89,8 @@ void MPCInitializer::initTransport(boost::property_tree::ptree const& property)

// add the service meta
ServiceConfigBuilder serviceConfigBuilder;
auto entryPoint =
serviceConfigBuilder.buildEntryPoint(MPC_SERVICE_TYPE, m_config->accessEntrypoint());
auto entryPoint = serviceConfigBuilder.buildEntryPoint(
getServiceName(m_config->agencyID(), MPC_SERVICE_TYPE), m_config->accessEntrypoint());
auto serviceConfig = serviceConfigBuilder.buildServiceConfig();
serviceConfig.addEntryPoint(entryPoint);
auto serviceMeta = serviceConfig.encode();
Expand Down

0 comments on commit ece2f12

Please sign in to comment.