diff options
author | capone212 <capone212@yandex-team.com> | 2023-11-28 12:34:08 +0300 |
---|---|---|
committer | capone212 <capone212@yandex-team.com> | 2023-11-28 14:14:19 +0300 |
commit | 6142e5846c3ae759361b6ef92f3f3e3b6a011cb8 (patch) | |
tree | b5a105fb69b99fd7dfaf3ed472492058ae84aa57 /yt | |
parent | 86474072cfc505a6c5fbc1bceef7a64ddc4cce69 (diff) | |
download | ydb-6142e5846c3ae759361b6ef92f3f3e3b6a011cb8.tar.gz |
YT-20123: Boilerplate for BundleController API
Diffstat (limited to 'yt')
-rw-r--r-- | yt/yt/client/CMakeLists.darwin-arm64.txt | 1 | ||||
-rw-r--r-- | yt/yt/client/CMakeLists.darwin-x86_64.txt | 1 | ||||
-rw-r--r-- | yt/yt/client/CMakeLists.linux-aarch64.txt | 1 | ||||
-rw-r--r-- | yt/yt/client/CMakeLists.linux-x86_64.txt | 1 | ||||
-rw-r--r-- | yt/yt/client/api/bundle_controller_client.cpp | 10 | ||||
-rw-r--r-- | yt/yt/client/api/bundle_controller_client.h | 34 | ||||
-rw-r--r-- | yt/yt/client/api/client.h | 2 | ||||
-rw-r--r-- | yt/yt/client/api/delegating_client.cpp | 7 | ||||
-rw-r--r-- | yt/yt/client/api/delegating_client.h | 4 | ||||
-rw-r--r-- | yt/yt/client/api/rpc_proxy/client_impl.cpp | 7 | ||||
-rw-r--r-- | yt/yt/client/api/rpc_proxy/client_impl.h | 4 | ||||
-rw-r--r-- | yt/yt/client/driver/authentication_commands.h | 2 | ||||
-rw-r--r-- | yt/yt/client/driver/bundle_controller_commands.cpp | 33 | ||||
-rw-r--r-- | yt/yt/client/driver/bundle_controller_commands.h | 25 | ||||
-rw-r--r-- | yt/yt/client/driver/driver.cpp | 5 | ||||
-rw-r--r-- | yt/yt/client/driver/ya.make | 1 | ||||
-rw-r--r-- | yt/yt/client/federated/client.cpp | 1 | ||||
-rw-r--r-- | yt/yt/client/hedging/hedging.cpp | 1 | ||||
-rw-r--r-- | yt/yt/client/unittests/mock/client.h | 4 | ||||
-rw-r--r-- | yt/yt/client/ya.make | 1 |
20 files changed, 144 insertions, 1 deletions
diff --git a/yt/yt/client/CMakeLists.darwin-arm64.txt b/yt/yt/client/CMakeLists.darwin-arm64.txt index 3536fc456a..3cfba2d716 100644 --- a/yt/yt/client/CMakeLists.darwin-arm64.txt +++ b/yt/yt/client/CMakeLists.darwin-arm64.txt @@ -56,6 +56,7 @@ target_sources(yt-yt-client PRIVATE ${CMAKE_SOURCE_DIR}/yt/yt/client/api/client_cache.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/delegating_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/etc_client.cpp + ${CMAKE_SOURCE_DIR}/yt/yt/client/api/bundle_controller_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/journal_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/operation_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/security_client.cpp diff --git a/yt/yt/client/CMakeLists.darwin-x86_64.txt b/yt/yt/client/CMakeLists.darwin-x86_64.txt index 3536fc456a..3cfba2d716 100644 --- a/yt/yt/client/CMakeLists.darwin-x86_64.txt +++ b/yt/yt/client/CMakeLists.darwin-x86_64.txt @@ -56,6 +56,7 @@ target_sources(yt-yt-client PRIVATE ${CMAKE_SOURCE_DIR}/yt/yt/client/api/client_cache.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/delegating_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/etc_client.cpp + ${CMAKE_SOURCE_DIR}/yt/yt/client/api/bundle_controller_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/journal_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/operation_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/security_client.cpp diff --git a/yt/yt/client/CMakeLists.linux-aarch64.txt b/yt/yt/client/CMakeLists.linux-aarch64.txt index 1a4a182116..5e96b7c47d 100644 --- a/yt/yt/client/CMakeLists.linux-aarch64.txt +++ b/yt/yt/client/CMakeLists.linux-aarch64.txt @@ -58,6 +58,7 @@ target_sources(yt-yt-client PRIVATE ${CMAKE_SOURCE_DIR}/yt/yt/client/api/client_cache.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/delegating_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/etc_client.cpp + ${CMAKE_SOURCE_DIR}/yt/yt/client/api/bundle_controller_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/journal_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/operation_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/security_client.cpp diff --git a/yt/yt/client/CMakeLists.linux-x86_64.txt b/yt/yt/client/CMakeLists.linux-x86_64.txt index 1a4a182116..5e96b7c47d 100644 --- a/yt/yt/client/CMakeLists.linux-x86_64.txt +++ b/yt/yt/client/CMakeLists.linux-x86_64.txt @@ -58,6 +58,7 @@ target_sources(yt-yt-client PRIVATE ${CMAKE_SOURCE_DIR}/yt/yt/client/api/client_cache.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/delegating_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/etc_client.cpp + ${CMAKE_SOURCE_DIR}/yt/yt/client/api/bundle_controller_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/journal_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/operation_client.cpp ${CMAKE_SOURCE_DIR}/yt/yt/client/api/security_client.cpp diff --git a/yt/yt/client/api/bundle_controller_client.cpp b/yt/yt/client/api/bundle_controller_client.cpp new file mode 100644 index 0000000000..969dfa55ea --- /dev/null +++ b/yt/yt/client/api/bundle_controller_client.cpp @@ -0,0 +1,10 @@ +#include "bundle_controller_client.h" + +namespace NYT::NApi { + +//////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NApi diff --git a/yt/yt/client/api/bundle_controller_client.h b/yt/yt/client/api/bundle_controller_client.h new file mode 100644 index 0000000000..16527ee0e0 --- /dev/null +++ b/yt/yt/client/api/bundle_controller_client.h @@ -0,0 +1,34 @@ +#pragma once + +#include "client_common.h" + +namespace NYT::NApi { + +//////////////////////////////////////////////////////////////////////////////// + +struct TGetBundleConfigOptions + : public TTimeoutOptions +{ }; + +//////////////////////////////////////////////////////////////////////////////// + +struct TBundleConfigDescriptor +{ + TString BundleName; +}; + +//////////////////////////////////////////////////////////////////////////////// + +struct IBundleControllerClient +{ + virtual ~IBundleControllerClient() + { } + + virtual TFuture<TBundleConfigDescriptor> GetBundleConfig( + const TString& bundleName, + const TGetBundleConfigOptions& options = {}) = 0; +}; + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NApi diff --git a/yt/yt/client/api/client.h b/yt/yt/client/api/client.h index 3248ea089a..07f5536e5e 100644 --- a/yt/yt/client/api/client.h +++ b/yt/yt/client/api/client.h @@ -13,6 +13,7 @@ #include "table_client.h" #include "queue_client.h" #include "query_tracker_client.h" +#include "bundle_controller_client.h" namespace NYT::NApi { @@ -65,6 +66,7 @@ struct IClient , public IAdminClient , public IQueryTrackerClient , public IEtcClient + , public IBundleControllerClient { //! Terminates all channels. //! Aborts all pending uncommitted transactions. diff --git a/yt/yt/client/api/delegating_client.cpp b/yt/yt/client/api/delegating_client.cpp index bc94114454..b834977aba 100644 --- a/yt/yt/client/api/delegating_client.cpp +++ b/yt/yt/client/api/delegating_client.cpp @@ -1004,6 +1004,13 @@ TFuture<void> TDelegatingClient::AlterQuery( return Underlying_->AlterQuery(queryId, options); } +TFuture<TBundleConfigDescriptor> TDelegatingClient::GetBundleConfig( + const TString& bundleName, + const TGetBundleConfigOptions& options) +{ + return Underlying_->GetBundleConfig(bundleName, options); +} + //////////////////////////////////////////////////////////////////////////////// // Method below ensures that delegating client contains implementations for all diff --git a/yt/yt/client/api/delegating_client.h b/yt/yt/client/api/delegating_client.h index 3eeaaa702e..c3125400eb 100644 --- a/yt/yt/client/api/delegating_client.h +++ b/yt/yt/client/api/delegating_client.h @@ -618,6 +618,10 @@ public: NQueryTrackerClient::TQueryId queryId, const TAlterQueryOptions& options) override; + virtual TFuture<TBundleConfigDescriptor> GetBundleConfig( + const TString& bundleName, + const TGetBundleConfigOptions& options = {}) override; + protected: const IClientPtr Underlying_; }; diff --git a/yt/yt/client/api/rpc_proxy/client_impl.cpp b/yt/yt/client/api/rpc_proxy/client_impl.cpp index eb77184dc0..93a763adaa 100644 --- a/yt/yt/client/api/rpc_proxy/client_impl.cpp +++ b/yt/yt/client/api/rpc_proxy/client_impl.cpp @@ -2031,6 +2031,13 @@ TFuture<void> TClient::AlterQuery( ThrowUnimplemented("AlterQuery"); } +TFuture<TBundleConfigDescriptor> TClient::GetBundleConfig( + const TString& /*bundleName*/, + const TGetBundleConfigOptions& /*options*/) +{ + ThrowUnimplemented("GetBundleConfig"); +} + TFuture<void> TClient::SetUserPassword( const TString& /*user*/, const TString& /*currentPasswordSha256*/, diff --git a/yt/yt/client/api/rpc_proxy/client_impl.h b/yt/yt/client/api/rpc_proxy/client_impl.h index ca31c75cae..9820d770b4 100644 --- a/yt/yt/client/api/rpc_proxy/client_impl.h +++ b/yt/yt/client/api/rpc_proxy/client_impl.h @@ -482,6 +482,10 @@ public: const TString& passwordSha256, const TListUserTokensOptions& options) override; + TFuture<TBundleConfigDescriptor> GetBundleConfig( + const TString& bundleName, + const TGetBundleConfigOptions& options = {}) override; + private: const TConnectionPtr Connection_; const NRpc::TDynamicChannelPoolPtr ChannelPool_; diff --git a/yt/yt/client/driver/authentication_commands.h b/yt/yt/client/driver/authentication_commands.h index 61fb454e60..5ae6f82720 100644 --- a/yt/yt/client/driver/authentication_commands.h +++ b/yt/yt/client/driver/authentication_commands.h @@ -1,3 +1,5 @@ +#pragma once + #include "command.h" namespace NYT::NDriver { diff --git a/yt/yt/client/driver/bundle_controller_commands.cpp b/yt/yt/client/driver/bundle_controller_commands.cpp new file mode 100644 index 0000000000..70f4058a7d --- /dev/null +++ b/yt/yt/client/driver/bundle_controller_commands.cpp @@ -0,0 +1,33 @@ +#include "bundle_controller_commands.h" + +#include <yt/yt/core/ytree/convert.h> + +namespace NYT::NDriver { + +using namespace NConcurrency; +using namespace NYson; +using namespace NYTree; + +//////////////////////////////////////////////////////////////////////////////// + +void TGetBundleConfigCommand::Register(TRegistrar registrar) +{ + registrar.Parameter("bundle_name", &TThis::BundleName_); +} + +void TGetBundleConfigCommand::DoExecute(ICommandContextPtr context) +{ + auto result = WaitFor(context->GetClient()->GetBundleConfig( + BundleName_, + Options)) + .ValueOrThrow(); + + context->ProduceOutputValue(BuildYsonStringFluently() + .BeginMap() + .Item("bundle_name").Value(result.BundleName) + .EndMap()); +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NDriver diff --git a/yt/yt/client/driver/bundle_controller_commands.h b/yt/yt/client/driver/bundle_controller_commands.h new file mode 100644 index 0000000000..46b94d84a4 --- /dev/null +++ b/yt/yt/client/driver/bundle_controller_commands.h @@ -0,0 +1,25 @@ +#pragma once + +#include "command.h" + +namespace NYT::NDriver { + +//////////////////////////////////////////////////////////////////////////////// + +class TGetBundleConfigCommand + : public TTypedCommand<NApi::TGetBundleConfigOptions> +{ +public: + REGISTER_YSON_STRUCT_LITE(TGetBundleConfigCommand); + + static void Register(TRegistrar registrar); + +private: + TString BundleName_; + + void DoExecute(ICommandContextPtr context) override; +}; + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NDriver diff --git a/yt/yt/client/driver/driver.cpp b/yt/yt/client/driver/driver.cpp index 25a9e4e342..f3e6288516 100644 --- a/yt/yt/client/driver/driver.cpp +++ b/yt/yt/client/driver/driver.cpp @@ -2,6 +2,7 @@ #include "authentication_commands.h" #include "admin_commands.h" +#include "bundle_controller_commands.h" #include "chaos_commands.h" #include "command.h" #include "config.h" @@ -355,7 +356,9 @@ public: REGISTER (TListQueriesCommand, "list_queries", Null, Structured, false, false, ApiVersion4); REGISTER (TGetQueryResultCommand, "get_query_result", Null, Structured, false, false, ApiVersion4); REGISTER (TReadQueryResultCommand, "read_query_result", Null, Tabular, false, true, ApiVersion4); - REGISTER (TAlterQueryCommand, "alter_query", Null, Tabular, false, false, ApiVersion4); + REGISTER (TAlterQueryCommand, "alter_query", Null, Tabular, false, false, ApiVersion4); + + REGISTER_ALL(TGetBundleConfigCommand, "get_bundle_config", Null, Structured, false, false); if (Config_->EnableInternalCommands) { REGISTER_ALL(TReadHunksCommand, "read_hunks", Null, Structured, false, true ); diff --git a/yt/yt/client/driver/ya.make b/yt/yt/client/driver/ya.make index 6e411686d0..7f030a6d8e 100644 --- a/yt/yt/client/driver/ya.make +++ b/yt/yt/client/driver/ya.make @@ -5,6 +5,7 @@ INCLUDE(${ARCADIA_ROOT}/yt/ya_cpp.make.inc) SRCS( admin_commands.cpp authentication_commands.cpp + bundle_controller_commands.cpp chaos_commands.cpp command.cpp config.cpp diff --git a/yt/yt/client/federated/client.cpp b/yt/yt/client/federated/client.cpp index d0bfe7a58a..8cfcddd3c2 100644 --- a/yt/yt/client/federated/client.cpp +++ b/yt/yt/client/federated/client.cpp @@ -407,6 +407,7 @@ public: UNIMPLEMENTED_METHOD(TFuture<TQuery>, GetQuery, (NQueryTrackerClient::TQueryId, const TGetQueryOptions&)); UNIMPLEMENTED_METHOD(TFuture<TListQueriesResult>, ListQueries, (const TListQueriesOptions&)); UNIMPLEMENTED_METHOD(TFuture<void>, AlterQuery, (NQueryTrackerClient::TQueryId, const TAlterQueryOptions&)); + UNIMPLEMENTED_METHOD(TFuture<TBundleConfigDescriptor>, GetBundleConfig, (const TString&, const TGetBundleConfigOptions&)); UNIMPLEMENTED_METHOD(TFuture<ITableReaderPtr>, CreateTableReader, (const NYPath::TRichYPath&, const TTableReaderOptions&)); UNIMPLEMENTED_METHOD(TFuture<ITableWriterPtr>, CreateTableWriter, (const NYPath::TRichYPath&, const TTableWriterOptions&)); diff --git a/yt/yt/client/hedging/hedging.cpp b/yt/yt/client/hedging/hedging.cpp index f415a8c614..b0ca0d55e3 100644 --- a/yt/yt/client/hedging/hedging.cpp +++ b/yt/yt/client/hedging/hedging.cpp @@ -210,6 +210,7 @@ public: UNSUPPORTED_METHOD(TFuture<TQuery>, GetQuery, (NQueryTrackerClient::TQueryId, const TGetQueryOptions&)); UNSUPPORTED_METHOD(TFuture<TListQueriesResult>, ListQueries, (const TListQueriesOptions&)); UNSUPPORTED_METHOD(TFuture<void>, AlterQuery, (NQueryTrackerClient::TQueryId, const TAlterQueryOptions&)); + UNSUPPORTED_METHOD(TFuture<TBundleConfigDescriptor>, GetBundleConfig, (const TString&, const TGetBundleConfigOptions&)); private: THedgingExecutorPtr Executor_; diff --git a/yt/yt/client/unittests/mock/client.h b/yt/yt/client/unittests/mock/client.h index 8c91a17251..3cabe9d56b 100644 --- a/yt/yt/client/unittests/mock/client.h +++ b/yt/yt/client/unittests/mock/client.h @@ -619,6 +619,10 @@ public: MOCK_METHOD(TFuture<void>, AlterQuery, ( NQueryTrackerClient::TQueryId queryId, const TAlterQueryOptions& options), (override)); + + MOCK_METHOD(TFuture<TBundleConfigDescriptor>, GetBundleConfig, ( + const TString& bundleName, + const TGetBundleConfigOptions& options), (override)); }; DEFINE_REFCOUNTED_TYPE(TMockClient) diff --git a/yt/yt/client/ya.make b/yt/yt/client/ya.make index e5b45791b2..4f6f2101a1 100644 --- a/yt/yt/client/ya.make +++ b/yt/yt/client/ya.make @@ -13,6 +13,7 @@ SRCS( api/client_cache.cpp api/delegating_client.cpp api/etc_client.cpp + api/bundle_controller_client.cpp api/journal_client.cpp api/operation_client.cpp api/security_client.cpp |