Skip to content

Commit e5e7419

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

File tree

6 files changed

+19
-11
lines changed

6 files changed

+19
-11
lines changed

.github/workflows/cpp_full_node_workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
fail-fast: false
3535
matrix:
36-
os: [macos-12, ubuntu-20.04]
36+
os: [macos-13, ubuntu-20.04]
3737
steps:
3838
- uses: actions/checkout@v2
3939
with:

.github/workflows/cpp_sdk_workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
fail-fast: false
3535
matrix:
36-
os: [ubuntu-22.04, windows-2019, macos-12]
36+
os: [ubuntu-22.04, windows-2019, macos-13]
3737
steps:
3838
- uses: actions/checkout@v2
3939
with:

.github/workflows/cpp_toolkit_workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
fail-fast: false
3535
matrix:
36-
os: [ubuntu-22.04, windows-2019, macos-12]
36+
os: [ubuntu-22.04, windows-2019, macos-13]
3737
steps:
3838
- uses: actions/checkout@v2
3939
with:
@@ -72,7 +72,7 @@ jobs:
7272
- name: Build for windows
7373
if: runner.os == 'Windows'
7474
run: |
75-
mkdir -p cpp/build && cd cpp/build && cmake -G "Visual Studio 16 2019" -A x64 -DBUILD_PYTHON=OFf -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_WEDPR_TOOLKIT=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DVCPKG_HOST_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake .. && MSBuild /version && MSBuild WeDPR-Component.sln /p:Configuration=Release /p:Platform=x64
75+
mkdir -p cpp/build && cd cpp/build && cmake -G "Visual Studio 16 2019" -A x64 -DBUILD_PYTHON=OFF -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_WEDPR_TOOLKIT=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DVCPKG_HOST_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake .. && MSBuild /version && MSBuild WeDPR-Component.sln /p:Configuration=Release /p:Platform=x64
7676
- name: Build for linux
7777
if: runner.os == 'Linux'
7878
run: |

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: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "ppc-framework/protocol/Constant.h"
2323
#include "ppc-mpc/src/MPCService.h"
2424
#include "ppc-tools/src/config/PPCConfig.h"
25+
#include "wedpr-helper/ppc-utilities/Utilities.h"
2526
#include "wedpr-protocol/protocol/src/ServiceConfig.h"
2627
#include "wedpr-transport/sdk/src/TransportBuilder.h"
2728

@@ -61,7 +62,7 @@ void MPCInitializer::init(std::string const& _configPath)
6162
auto threadPool = std::make_shared<bcos::ThreadPool>("mpc-pool", threadPoolSize);
6263

6364
INIT_LOG(INFO) << LOG_DESC("init the mpc threadpool")
64-
<< LOG_KV("threadPoolSize", threadPoolSize);
65+
<< LOG_KV("threadPoolSize", threadPoolSize);
6566

6667
auto mpcService = std::make_shared<MPCService>();
6768
mpcService->setMPCConfig(mpcConfig);
@@ -71,11 +72,11 @@ void MPCInitializer::init(std::string const& _configPath)
7172
m_rpc->registerHandler("run", std::bind(&MPCService::runMpcRpc, mpcService,
7273
std::placeholders::_1, std::placeholders::_2));
7374
m_rpc->registerHandler("asyncRun", std::bind(&MPCService::asyncRunMpcRpc, mpcService,
74-
std::placeholders::_1, std::placeholders::_2));
75+
std::placeholders::_1, std::placeholders::_2));
7576
m_rpc->registerHandler("kill", std::bind(&MPCService::killMpcRpc, mpcService,
7677
std::placeholders::_1, std::placeholders::_2));
7778
m_rpc->registerHandler("query", std::bind(&MPCService::queryMpcRpc, mpcService,
78-
std::placeholders::_1, std::placeholders::_2));
79+
std::placeholders::_1, std::placeholders::_2));
7980
INIT_LOG(INFO) << LOG_DESC("init the mpc rpc success");
8081
// init the transport
8182
initTransport(pt);
@@ -89,8 +90,8 @@ void MPCInitializer::initTransport(boost::property_tree::ptree const& property)
8990

9091
// add the service meta
9192
ServiceConfigBuilder serviceConfigBuilder;
92-
auto entryPoint =
93-
serviceConfigBuilder.buildEntryPoint(MPC_SERVICE_TYPE, m_config->accessEntrypoint());
93+
auto entryPoint = serviceConfigBuilder.buildEntryPoint(
94+
getServiceName(m_config->agencyID(), MPC_SERVICE_TYPE), m_config->accessEntrypoint());
9495
auto serviceConfig = serviceConfigBuilder.buildServiceConfig();
9596
serviceConfig.addEntryPoint(entryPoint);
9697
auto serviceMeta = serviceConfig.encode();

0 commit comments

Comments
 (0)