aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorilnaz <ilnaz@ydb.tech>2023-02-15 14:37:43 +0300
committerilnaz <ilnaz@ydb.tech>2023-02-15 14:37:43 +0300
commit79e8b671dc1bba560b7109db746b0102f1c797c1 (patch)
treeee7f8273991e71e997e3ff365e2f3b0c60d95304
parent035869d341443170edbe237c87bbb0347ad08f50 (diff)
downloadydb-79e8b671dc1bba560b7109db746b0102f1c797c1.tar.gz
Move to separate lib, configurable lookup path
-rw-r--r--ydb/core/CMakeLists.txt1
-rw-r--r--ydb/core/base/CMakeLists.darwin.txt1
-rw-r--r--ydb/core/base/CMakeLists.linux-aarch64.txt1
-rw-r--r--ydb/core/base/CMakeLists.linux.txt1
-rw-r--r--ydb/core/discovery/CMakeLists.darwin.txt20
-rw-r--r--ydb/core/discovery/CMakeLists.linux-aarch64.txt21
-rw-r--r--ydb/core/discovery/CMakeLists.linux.txt21
-rw-r--r--ydb/core/discovery/CMakeLists.txt15
-rw-r--r--ydb/core/discovery/discovery.cpp (renamed from ydb/core/base/discovery.cpp)12
-rw-r--r--ydb/core/discovery/discovery.h (renamed from ydb/core/base/discovery.h)9
-rw-r--r--ydb/core/grpc_services/CMakeLists.darwin.txt1
-rw-r--r--ydb/core/grpc_services/CMakeLists.linux-aarch64.txt1
-rw-r--r--ydb/core/grpc_services/CMakeLists.linux.txt1
-rw-r--r--ydb/core/grpc_services/rpc_discovery.cpp5
14 files changed, 97 insertions, 13 deletions
diff --git a/ydb/core/CMakeLists.txt b/ydb/core/CMakeLists.txt
index 568ae75971c..4d098f4622f 100644
--- a/ydb/core/CMakeLists.txt
+++ b/ydb/core/CMakeLists.txt
@@ -16,6 +16,7 @@ add_subdirectory(client)
add_subdirectory(cms)
add_subdirectory(control)
add_subdirectory(debug)
+add_subdirectory(discovery)
add_subdirectory(driver_lib)
add_subdirectory(engine)
add_subdirectory(erasure)
diff --git a/ydb/core/base/CMakeLists.darwin.txt b/ydb/core/base/CMakeLists.darwin.txt
index 620438b37f4..0d68a17abee 100644
--- a/ydb/core/base/CMakeLists.darwin.txt
+++ b/ydb/core/base/CMakeLists.darwin.txt
@@ -47,7 +47,6 @@ target_sources(ydb-core-base PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/base/board_replica.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/blobstorage.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/counters.cpp
- ${CMAKE_SOURCE_DIR}/ydb/core/base/discovery.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/event_filter.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/group_stat.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/kikimr_issue.cpp
diff --git a/ydb/core/base/CMakeLists.linux-aarch64.txt b/ydb/core/base/CMakeLists.linux-aarch64.txt
index 2ae07134f3d..b7db9bc79f8 100644
--- a/ydb/core/base/CMakeLists.linux-aarch64.txt
+++ b/ydb/core/base/CMakeLists.linux-aarch64.txt
@@ -48,7 +48,6 @@ target_sources(ydb-core-base PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/base/board_replica.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/blobstorage.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/counters.cpp
- ${CMAKE_SOURCE_DIR}/ydb/core/base/discovery.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/event_filter.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/group_stat.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/kikimr_issue.cpp
diff --git a/ydb/core/base/CMakeLists.linux.txt b/ydb/core/base/CMakeLists.linux.txt
index 2ae07134f3d..b7db9bc79f8 100644
--- a/ydb/core/base/CMakeLists.linux.txt
+++ b/ydb/core/base/CMakeLists.linux.txt
@@ -48,7 +48,6 @@ target_sources(ydb-core-base PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/base/board_replica.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/blobstorage.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/counters.cpp
- ${CMAKE_SOURCE_DIR}/ydb/core/base/discovery.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/event_filter.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/group_stat.cpp
${CMAKE_SOURCE_DIR}/ydb/core/base/kikimr_issue.cpp
diff --git a/ydb/core/discovery/CMakeLists.darwin.txt b/ydb/core/discovery/CMakeLists.darwin.txt
new file mode 100644
index 00000000000..c0cec4da9f8
--- /dev/null
+++ b/ydb/core/discovery/CMakeLists.darwin.txt
@@ -0,0 +1,20 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(ydb-core-discovery)
+target_link_libraries(ydb-core-discovery PUBLIC
+ contrib-libs-cxxsupp
+ yutil
+ ydb-core-base
+ core-tx-scheme_cache
+ cpp-actors-core
+)
+target_sources(ydb-core-discovery PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/core/discovery/discovery.cpp
+)
diff --git a/ydb/core/discovery/CMakeLists.linux-aarch64.txt b/ydb/core/discovery/CMakeLists.linux-aarch64.txt
new file mode 100644
index 00000000000..947d35199c1
--- /dev/null
+++ b/ydb/core/discovery/CMakeLists.linux-aarch64.txt
@@ -0,0 +1,21 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(ydb-core-discovery)
+target_link_libraries(ydb-core-discovery PUBLIC
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ ydb-core-base
+ core-tx-scheme_cache
+ cpp-actors-core
+)
+target_sources(ydb-core-discovery PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/core/discovery/discovery.cpp
+)
diff --git a/ydb/core/discovery/CMakeLists.linux.txt b/ydb/core/discovery/CMakeLists.linux.txt
new file mode 100644
index 00000000000..947d35199c1
--- /dev/null
+++ b/ydb/core/discovery/CMakeLists.linux.txt
@@ -0,0 +1,21 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(ydb-core-discovery)
+target_link_libraries(ydb-core-discovery PUBLIC
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ ydb-core-base
+ core-tx-scheme_cache
+ cpp-actors-core
+)
+target_sources(ydb-core-discovery PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/core/discovery/discovery.cpp
+)
diff --git a/ydb/core/discovery/CMakeLists.txt b/ydb/core/discovery/CMakeLists.txt
new file mode 100644
index 00000000000..5bb4faffb40
--- /dev/null
+++ b/ydb/core/discovery/CMakeLists.txt
@@ -0,0 +1,15 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND UNIX AND NOT APPLE AND NOT ANDROID)
+ include(CMakeLists.linux-aarch64.txt)
+elseif (APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ include(CMakeLists.darwin.txt)
+elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE AND NOT ANDROID)
+ include(CMakeLists.linux.txt)
+endif()
diff --git a/ydb/core/base/discovery.cpp b/ydb/core/discovery/discovery.cpp
index e504f34ef35..41ac6421ca0 100644
--- a/ydb/core/base/discovery.cpp
+++ b/ydb/core/discovery/discovery.cpp
@@ -133,6 +133,7 @@ namespace NDiscoveryPrivate {
}
class TDiscoverer: public TActorBootstrapped<TDiscoverer> {
+ TLookupPathFunc MakeLookupPath;
const TString Database;
const TActorId ReplyTo;
const TActorId CacheId;
@@ -153,8 +154,9 @@ public:
return NKikimrServices::TActivity::DISCOVERY_ACTOR;
}
- explicit TDiscoverer(const TString& database, const TActorId& replyTo, const TActorId& cacheId)
- : Database(database)
+ explicit TDiscoverer(TLookupPathFunc f, const TString& database, const TActorId& replyTo, const TActorId& cacheId)
+ : MakeLookupPath(f)
+ , Database(database)
, ReplyTo(replyTo)
, CacheId(cacheId)
{
@@ -291,7 +293,7 @@ public:
}
const auto stateStorageGroupId = domainInfo->DefaultStateStorageGroup;
- const auto reqPath = MakeEndpointsBoardPath(database);
+ const auto reqPath = MakeLookupPath(database);
Send(CacheId, new NDiscoveryPrivate::TEvPrivate::TEvRequest(reqPath, stateStorageGroupId), 0, ++LookupCookie);
LookupResponse.Reset();
@@ -324,8 +326,8 @@ public:
}
};
-IActor* CreateDiscoverer(const TString& database, const TActorId& replyTo, const TActorId& cacheId) {
- return new TDiscoverer(database, replyTo, cacheId);
+IActor* CreateDiscoverer(TLookupPathFunc f, const TString& database, const TActorId& replyTo, const TActorId& cacheId) {
+ return new TDiscoverer(f, database, replyTo, cacheId);
}
IActor* CreateDiscoveryCache() {
diff --git a/ydb/core/base/discovery.h b/ydb/core/discovery/discovery.h
index c9b8ad05475..5174fa4e07c 100644
--- a/ydb/core/base/discovery.h
+++ b/ydb/core/discovery/discovery.h
@@ -1,7 +1,8 @@
#pragma once
-#include "defs.h"
-#include "events.h"
+#include <ydb/core/base/events.h>
+
+#include <library/cpp/actors/core/actor.h>
namespace NKikimr {
@@ -30,10 +31,12 @@ struct TEvDiscovery {
};
};
+using TLookupPathFunc = std::function<TString(const TString&)>;
+
// Reply with:
// - in case of success: TEvStateStorage::TEvBoardInfo
// - otherwise: TEvDiscovery::TEvError
-IActor* CreateDiscoverer(const TString& database, const TActorId& replyTo, const TActorId& cacheId);
+IActor* CreateDiscoverer(TLookupPathFunc f, const TString& database, const TActorId& replyTo, const TActorId& cacheId);
// Used to reduce number of requests to Board
IActor* CreateDiscoveryCache();
diff --git a/ydb/core/grpc_services/CMakeLists.darwin.txt b/ydb/core/grpc_services/CMakeLists.darwin.txt
index c50b53c3e06..927b117349d 100644
--- a/ydb/core/grpc_services/CMakeLists.darwin.txt
+++ b/ydb/core/grpc_services/CMakeLists.darwin.txt
@@ -25,6 +25,7 @@ target_link_libraries(ydb-core-grpc_services PUBLIC
ydb-core-actorlib_impl
ydb-core-base
ydb-core-control
+ ydb-core-discovery
ydb-core-engine
ydb-core-formats
core-grpc_services-counters
diff --git a/ydb/core/grpc_services/CMakeLists.linux-aarch64.txt b/ydb/core/grpc_services/CMakeLists.linux-aarch64.txt
index e7fec1e47df..d4495d79809 100644
--- a/ydb/core/grpc_services/CMakeLists.linux-aarch64.txt
+++ b/ydb/core/grpc_services/CMakeLists.linux-aarch64.txt
@@ -26,6 +26,7 @@ target_link_libraries(ydb-core-grpc_services PUBLIC
ydb-core-actorlib_impl
ydb-core-base
ydb-core-control
+ ydb-core-discovery
ydb-core-engine
ydb-core-formats
core-grpc_services-counters
diff --git a/ydb/core/grpc_services/CMakeLists.linux.txt b/ydb/core/grpc_services/CMakeLists.linux.txt
index e7fec1e47df..d4495d79809 100644
--- a/ydb/core/grpc_services/CMakeLists.linux.txt
+++ b/ydb/core/grpc_services/CMakeLists.linux.txt
@@ -26,6 +26,7 @@ target_link_libraries(ydb-core-grpc_services PUBLIC
ydb-core-actorlib_impl
ydb-core-base
ydb-core-control
+ ydb-core-discovery
ydb-core-engine
ydb-core-formats
core-grpc_services-counters
diff --git a/ydb/core/grpc_services/rpc_discovery.cpp b/ydb/core/grpc_services/rpc_discovery.cpp
index 088eed6a2fc..3cf14e7c437 100644
--- a/ydb/core/grpc_services/rpc_discovery.cpp
+++ b/ydb/core/grpc_services/rpc_discovery.cpp
@@ -3,8 +3,8 @@
#include "rpc_calls.h"
#include "rpc_kqp_base.h"
-#include <ydb/core/base/discovery.h>
#include <ydb/core/base/location.h>
+#include <ydb/core/discovery/discovery.h>
#include <ydb/library/yql/public/issue/yql_issue_message.h>
#include <ydb/library/yql/public/issue/yql_issue.h>
@@ -41,7 +41,8 @@ public:
void Bootstrap() {
// request endpoints
- Discoverer = Register(CreateDiscoverer(Request->GetProtoRequest()->database(), SelfId(), CacheId));
+ Discoverer = Register(CreateDiscoverer(&MakeEndpointsBoardPath,
+ Request->GetProtoRequest()->database(), SelfId(), CacheId));
// request self node info
Send(GetNameserviceActorId(), new TEvInterconnect::TEvGetNode(SelfId().NodeId()));