diff --git a/examples/basic_example/basic_example.cpp b/examples/basic_example/basic_example.cpp index 13d5930b9c3..126f9eecd14 100644 --- a/examples/basic_example/basic_example.cpp +++ b/examples/basic_example/basic_example.cpp @@ -8,25 +8,7 @@ using namespace NYdb; using namespace NYdb::NQuery; - -class TYdbErrorException : public yexception { -public: - TYdbErrorException(const TStatus& status) - : Status(status) {} - - TStatus Status; -}; - -static void ThrowOnError(const TStatus& status) { - if (!status.IsSuccess()) { - throw TYdbErrorException(status) << status; - } -} - -static void PrintStatus(const TStatus& status) { - std::cerr << "Status: " << ToString(status.GetStatus()) << std::endl; - std::cerr << status.GetIssues().ToString(); -} +using namespace NYdb::NStatusHelpers; template std::string OptionalToString(const std::optional& opt) { @@ -502,8 +484,7 @@ bool Run(const TDriver& driver) { DropTables(client); } catch (const TYdbErrorException& e) { - std::cerr << "Execution failed due to fatal error:" << std::endl; - PrintStatus(e.Status); + std::cerr << "Execution failed due to fatal error: " << e.what() << std::endl; return false; } diff --git a/examples/pagination/pagination.cpp b/examples/pagination/pagination.cpp index c6080b9df7f..4a1a1300db8 100644 --- a/examples/pagination/pagination.cpp +++ b/examples/pagination/pagination.cpp @@ -7,28 +7,10 @@ using namespace NYdb; using namespace NYdb::NTable; +using namespace NYdb::NStatusHelpers; const uint32_t MaxPages = 10; -class TYdbErrorException : public yexception { -public: - TYdbErrorException(const TStatus& status) - : Status(status) {} - - TStatus Status; -}; - -static void ThrowOnError(const TStatus& status) { - if (!status.IsSuccess()) { - throw TYdbErrorException(status) << status; - } -} - -static void PrintStatus(const TStatus& status) { - std::cerr << "Status: " << ToString(status.GetStatus()) << std::endl; - std::cerr << status.GetIssues().ToString(); -} - static std::string JoinPath(const std::string& basePath, const std::string& path) { if (basePath.empty()) { return path; @@ -184,8 +166,7 @@ bool Run(const TDriver& driver, const std::string& path) { } } catch (const TYdbErrorException& e) { - std::cerr << "Execution failed due to fatal error:" << std::endl; - PrintStatus(e.Status); + std::cerr << "Execution failed due to fatal error: " << e.what() << std::endl; return false; } diff --git a/examples/secondary_index/main.cpp b/examples/secondary_index/main.cpp index bd48d107cfe..3fb520bb21c 100644 --- a/examples/secondary_index/main.cpp +++ b/examples/secondary_index/main.cpp @@ -2,6 +2,7 @@ using namespace NLastGetopt; using namespace NYdb; +using namespace NYdb::NStatusHelpers; //////////////////////////////////////////////////////////////////////////////// @@ -61,7 +62,7 @@ int main(int argc, char** argv) { return RunDeleteSeries(driver, prefix, argc, argv); } } catch (const TYdbErrorException& e) { - std::cerr << "Execution failed: " << e << std::endl; + std::cerr << "Execution failed: " << e.what() << std::endl; return 1; } diff --git a/examples/secondary_index/secondary_index.h b/examples/secondary_index/secondary_index.h index 755ba617fb1..273b4edc267 100644 --- a/examples/secondary_index/secondary_index.h +++ b/examples/secondary_index/secondary_index.h @@ -41,33 +41,6 @@ std::string JoinPath(const std::string& prefix, const std::string& path); //////////////////////////////////////////////////////////////////////////////// -class TYdbErrorException : public yexception { -public: - TYdbErrorException(NYdb::TStatus status) - : Status(std::move(status)) - { } - - friend std::ostream& operator<<(std::ostream& out, const TYdbErrorException& e) { - out << "Status: " << ToString(e.Status.GetStatus()); - if (e.Status.GetIssues()) { - out << std::endl; - out << e.Status.GetIssues().ToString(); - } - return out; - } - -private: - NYdb::TStatus Status; -}; - -inline void ThrowOnError(NYdb::TStatus status) { - if (!status.IsSuccess()) { - throw TYdbErrorException(status) << status; - } -} - -//////////////////////////////////////////////////////////////////////////////// - int RunCreateTables(NYdb::TDriver& driver, const std::string& prefix, int argc, char** argv); int RunDropTables(NYdb::TDriver& driver, const std::string& prefix, int argc, char** argv); int RunUpdateViews(NYdb::TDriver& driver, const std::string& prefix, int argc, char** argv); diff --git a/examples/secondary_index/secondary_index_create.cpp b/examples/secondary_index/secondary_index_create.cpp index 3b0151a003b..ac0f556967c 100644 --- a/examples/secondary_index/secondary_index_create.cpp +++ b/examples/secondary_index/secondary_index_create.cpp @@ -3,6 +3,7 @@ using namespace NLastGetopt; using namespace NYdb; using namespace NYdb::NTable; +using namespace NYdb::NStatusHelpers; //////////////////////////////////////////////////////////////////////////////// diff --git a/examples/secondary_index/secondary_index_delete.cpp b/examples/secondary_index/secondary_index_delete.cpp index 6fe7719f62d..5f38f76f0ad 100644 --- a/examples/secondary_index/secondary_index_delete.cpp +++ b/examples/secondary_index/secondary_index_delete.cpp @@ -3,6 +3,7 @@ using namespace NLastGetopt; using namespace NYdb; using namespace NYdb::NTable; +using namespace NYdb::NStatusHelpers; //////////////////////////////////////////////////////////////////////////////// diff --git a/examples/secondary_index/secondary_index_drop.cpp b/examples/secondary_index/secondary_index_drop.cpp index c6b7f84ca67..d7531786d4f 100644 --- a/examples/secondary_index/secondary_index_drop.cpp +++ b/examples/secondary_index/secondary_index_drop.cpp @@ -3,6 +3,7 @@ using namespace NLastGetopt; using namespace NYdb; using namespace NYdb::NTable; +using namespace NYdb::NStatusHelpers; //////////////////////////////////////////////////////////////////////////////// diff --git a/examples/secondary_index/secondary_index_generate.cpp b/examples/secondary_index/secondary_index_generate.cpp index 4307f112c94..70398166929 100644 --- a/examples/secondary_index/secondary_index_generate.cpp +++ b/examples/secondary_index/secondary_index_generate.cpp @@ -8,6 +8,7 @@ using namespace NLastGetopt; using namespace NYdb; using namespace NYdb::NTable; +using namespace NYdb::NStatusHelpers; namespace { diff --git a/examples/secondary_index/secondary_index_list.cpp b/examples/secondary_index/secondary_index_list.cpp index e1502f5274e..59e127d8ba7 100644 --- a/examples/secondary_index/secondary_index_list.cpp +++ b/examples/secondary_index/secondary_index_list.cpp @@ -5,6 +5,7 @@ using namespace NLastGetopt; using namespace NYdb; using namespace NYdb::NTable; +using namespace NYdb::NStatusHelpers; //////////////////////////////////////////////////////////////////////////////// diff --git a/examples/secondary_index/secondary_index_update.cpp b/examples/secondary_index/secondary_index_update.cpp index 52a1b22fe55..f040b192a0f 100644 --- a/examples/secondary_index/secondary_index_update.cpp +++ b/examples/secondary_index/secondary_index_update.cpp @@ -3,6 +3,7 @@ using namespace NLastGetopt; using namespace NYdb; using namespace NYdb::NTable; +using namespace NYdb::NStatusHelpers; //////////////////////////////////////////////////////////////////////////////// diff --git a/examples/secondary_index_builtin/main.cpp b/examples/secondary_index_builtin/main.cpp index 47660778152..331ad7ed531 100644 --- a/examples/secondary_index_builtin/main.cpp +++ b/examples/secondary_index_builtin/main.cpp @@ -2,6 +2,7 @@ using namespace NLastGetopt; using namespace NYdb; +using namespace NYdb::NStatusHelpers; int main(int argc, char** argv) { @@ -56,7 +57,7 @@ int main(int argc, char** argv) { } } catch (const TYdbErrorException& e) { - std::cerr << "Execution failed: " << e << std::endl; + std::cerr << "Execution failed: " << e.what() << std::endl; return 1; } } diff --git a/examples/secondary_index_builtin/secondary_index.h b/examples/secondary_index_builtin/secondary_index.h index f32bf8799de..ed22b2a28d2 100644 --- a/examples/secondary_index_builtin/secondary_index.h +++ b/examples/secondary_index_builtin/secondary_index.h @@ -52,30 +52,6 @@ struct TSeries { , UploadedUserId(uploadedUserId) {} }; -class TYdbErrorException: public yexception { -public: - TYdbErrorException(NYdb::TStatus status) - : Status(std::move(status)) - { } - - friend std::ostream& operator<<(std::ostream& out, const TYdbErrorException& e) { - out << "Status:" << ToString(e.Status.GetStatus()); - if (e.Status.GetIssues()) { - out << std::endl; - out << e.Status.GetIssues().ToString(); - } - return out; - } -private: - NYdb::TStatus Status; -}; - -inline void ThrowOnError(NYdb::TStatus status) { - if (!status.IsSuccess()){ - throw TYdbErrorException(status) << status; - } -} - std::string GetCommandsList(); TCommand Parse(const char *stringCmnd); std::string JoinPath(const std::string& prefix, const std::string& path); diff --git a/examples/secondary_index_builtin/secondary_index_create.cpp b/examples/secondary_index_builtin/secondary_index_create.cpp index 95bac95b18e..5b794b6dbdb 100644 --- a/examples/secondary_index_builtin/secondary_index_create.cpp +++ b/examples/secondary_index_builtin/secondary_index_create.cpp @@ -2,6 +2,7 @@ using namespace NYdb; using namespace NYdb::NTable; +using namespace NYdb::NStatusHelpers; using namespace NLastGetopt; static void CreateSeriesTable(TTableClient& client, const std::string& path) { diff --git a/examples/secondary_index_builtin/secondary_index_drop.cpp b/examples/secondary_index_builtin/secondary_index_drop.cpp index e04da7ff168..06d5be52b15 100644 --- a/examples/secondary_index_builtin/secondary_index_drop.cpp +++ b/examples/secondary_index_builtin/secondary_index_drop.cpp @@ -1,6 +1,7 @@ #include "secondary_index.h" using namespace NYdb::NTable; +using namespace NYdb::NStatusHelpers; using namespace NYdb; static void DropTable(TTableClient& client, const std::string& path) { diff --git a/examples/secondary_index_builtin/secondary_index_fill.cpp b/examples/secondary_index_builtin/secondary_index_fill.cpp index 2da26052630..6747e2f06f0 100644 --- a/examples/secondary_index_builtin/secondary_index_fill.cpp +++ b/examples/secondary_index_builtin/secondary_index_fill.cpp @@ -4,6 +4,7 @@ using namespace NYdb; using namespace NYdb::NTable; +using namespace NYdb::NStatusHelpers; std::vector GetSeries() { std::vector series = { diff --git a/examples/secondary_index_builtin/secondary_index_select.cpp b/examples/secondary_index_builtin/secondary_index_select.cpp index bba83d6deb4..a659984624f 100644 --- a/examples/secondary_index_builtin/secondary_index_select.cpp +++ b/examples/secondary_index_builtin/secondary_index_select.cpp @@ -2,6 +2,7 @@ using namespace NYdb; using namespace NYdb::NTable; +using namespace NYdb::NStatusHelpers; using namespace NLastGetopt; TStatus SelectSeriesWithViews(TSession session, const std::string& path, std::vector& selectResult, uint64_t minViews) { diff --git a/examples/secondary_index_builtin/secondary_index_select_join.cpp b/examples/secondary_index_builtin/secondary_index_select_join.cpp index f93a62c167e..d2874e121de 100644 --- a/examples/secondary_index_builtin/secondary_index_select_join.cpp +++ b/examples/secondary_index_builtin/secondary_index_select_join.cpp @@ -2,6 +2,7 @@ using namespace NYdb; using namespace NYdb::NTable; +using namespace NYdb::NStatusHelpers; using namespace NLastGetopt; TStatus SelectSeriesWithUserName(TSession session, const std::string& path, diff --git a/examples/topic_writer/transaction/main.cpp b/examples/topic_writer/transaction/main.cpp index 23ffdbbb1ca..c98c8df8e1c 100644 --- a/examples/topic_writer/transaction/main.cpp +++ b/examples/topic_writer/transaction/main.cpp @@ -1,15 +1,6 @@ #include #include -void ThrowOnError(const NYdb::TStatus& status) -{ - if (status.IsSuccess()) { - return; - } - - ythrow yexception() << status; -} - int main() { const std::string ENDPOINT = "HOST:PORT"; diff --git a/examples/ttl/main.cpp b/examples/ttl/main.cpp index 1d98c1c01d2..031a06d737a 100644 --- a/examples/ttl/main.cpp +++ b/examples/ttl/main.cpp @@ -4,6 +4,7 @@ using namespace NLastGetopt; using namespace NYdb; +using namespace NYdb::NStatusHelpers; void StopHandler(int) { exit(1); diff --git a/examples/ttl/ttl.cpp b/examples/ttl/ttl.cpp index bc6086ab5db..9ec2eafd5bd 100644 --- a/examples/ttl/ttl.cpp +++ b/examples/ttl/ttl.cpp @@ -6,6 +6,7 @@ using namespace NExample; using namespace NYdb; using namespace NYdb::NTable; +using namespace NYdb::NStatusHelpers; constexpr uint32_t DOC_TABLE_PARTITION_COUNT = 4; constexpr uint32_t EXPIRATION_QUEUE_COUNT = 4; @@ -334,8 +335,7 @@ bool Run(const TDriver& driver, const std::string& path) { ReadDocument(client, path, "https://ya.ru/"); } catch (const TYdbErrorException& e) { - std::cerr << "Execution failed due to fatal error:" << std::endl; - PrintStatus(e.Status); + std::cerr << "Execution failed due to fatal error: " << e.what() << std::endl; return false; } diff --git a/examples/ttl/util.h b/examples/ttl/util.h index 5c25a660dd9..a2a8bd3256a 100644 --- a/examples/ttl/util.h +++ b/examples/ttl/util.h @@ -12,25 +12,6 @@ namespace NExample { using namespace NYdb; using namespace NYdb::NTable; -class TYdbErrorException : public yexception { -public: - TYdbErrorException(const TStatus& status) - : Status(status) {} - - TStatus Status; -}; - -inline void ThrowOnError(const TStatus& status) { - if (!status.IsSuccess()) { - throw TYdbErrorException(status) << status; - } -} - -inline void PrintStatus(const TStatus& status) { - std::cerr << "Status: " << ToString(status.GetStatus()) << std::endl; - std::cerr << status.GetIssues().ToString(); -} - inline std::string JoinPath(const std::string& basePath, const std::string& path) { if (basePath.empty()) { return path; diff --git a/include/ydb-cpp-sdk/client/bsconfig/storage_config.h b/include/ydb-cpp-sdk/client/bsconfig/storage_config.h new file mode 100644 index 00000000000..4e6613df022 --- /dev/null +++ b/include/ydb-cpp-sdk/client/bsconfig/storage_config.h @@ -0,0 +1,53 @@ +#pragma once + +#include +#include +#include +#include +#include + +#include +#include + +namespace NYdb::inline V3::NStorageConfig { + +struct TFetchStorageConfigResult : public TStatus { + TFetchStorageConfigResult( + TStatus&& status, + std::string&& config) + : TStatus(std::move(status)) + , Config_(std::move(config)) + {} + + const std::string& GetConfig() const { + return Config_; + } + +private: + std::string Config_; +}; + +using TAsyncFetchStorageConfigResult = NThreading::TFuture; + +struct TStorageConfigSettings : public NYdb::TOperationRequestSettings {}; + +class TStorageConfigClient { +public: + + explicit TStorageConfigClient(const TDriver& driver, const TCommonClientSettings& settings = {}); + + ~TStorageConfigClient(); + + // Replace config + TAsyncStatus ReplaceStorageConfig(const std::string& config); + + // Fetch current cluster storage config + TAsyncFetchStorageConfigResult FetchStorageConfig(const TStorageConfigSettings& settings = {}); + +private: + class TImpl; + + std::unique_ptr Impl_; +}; + +} diff --git a/include/ydb-cpp-sdk/client/common_client/settings.h b/include/ydb-cpp-sdk/client/common_client/settings.h index 8d77fe0fe98..302898dea41 100644 --- a/include/ydb-cpp-sdk/client/common_client/settings.h +++ b/include/ydb-cpp-sdk/client/common_client/settings.h @@ -8,7 +8,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { using TCertificateAndPrivateKey = std::pair; diff --git a/include/ydb-cpp-sdk/client/common_client/ssl_credentials.h b/include/ydb-cpp-sdk/client/common_client/ssl_credentials.h index be66fe80107..3b452b9d03d 100644 --- a/include/ydb-cpp-sdk/client/common_client/ssl_credentials.h +++ b/include/ydb-cpp-sdk/client/common_client/ssl_credentials.h @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { struct TSslCredentials { bool IsEnabled = false; diff --git a/include/ydb-cpp-sdk/client/coordination/coordination.h b/include/ydb-cpp-sdk/client/coordination/coordination.h index 695df8b5cd2..8d4fa0f1f45 100644 --- a/include/ydb-cpp-sdk/client/coordination/coordination.h +++ b/include/ydb-cpp-sdk/client/coordination/coordination.h @@ -10,7 +10,7 @@ namespace Coordination { } } -namespace NYdb { +namespace NYdb::inline V3 { namespace NScheme { struct TPermissions; diff --git a/include/ydb-cpp-sdk/client/datastreams/datastreams.h b/include/ydb-cpp-sdk/client/datastreams/datastreams.h index b995d75b2fb..59329a21279 100644 --- a/include/ydb-cpp-sdk/client/datastreams/datastreams.h +++ b/include/ydb-cpp-sdk/client/datastreams/datastreams.h @@ -4,7 +4,7 @@ #include -namespace NYdb::NDataStreams::V1 { +namespace NYdb::inline V3::NDataStreams::V1 { template class TProtoResultWrapper : public NYdb::TStatus { diff --git a/include/ydb-cpp-sdk/client/debug/client.h b/include/ydb-cpp-sdk/client/debug/client.h index bfd8a946794..7ee45e5a4fc 100644 --- a/include/ydb-cpp-sdk/client/debug/client.h +++ b/include/ydb-cpp-sdk/client/debug/client.h @@ -2,7 +2,7 @@ #include -namespace NYdb::NDebug { +namespace NYdb::inline V3::NDebug { //////////////////////////////////////////////////////////////////////////////// @@ -80,4 +80,4 @@ class TDebugClient { std::shared_ptr Impl_; }; -} // namespace NYdb::NDebug +} // namespace NYdb::V3::NDebug diff --git a/include/ydb-cpp-sdk/client/discovery/discovery.h b/include/ydb-cpp-sdk/client/discovery/discovery.h index 81301e189ce..f9bf7a2723c 100644 --- a/include/ydb-cpp-sdk/client/discovery/discovery.h +++ b/include/ydb-cpp-sdk/client/discovery/discovery.h @@ -12,7 +12,7 @@ namespace Discovery { } // namespace Discovery } // namespace Ydb -namespace NYdb { +namespace NYdb::inline V3 { namespace NDiscovery { //////////////////////////////////////////////////////////////////////////////// @@ -140,5 +140,5 @@ class TDiscoveryClient { std::shared_ptr Impl_; }; -} // namespace NTable } // namespace NDiscovery +} // namespace NYdb diff --git a/include/ydb-cpp-sdk/client/draft/ydb_dynamic_config.h b/include/ydb-cpp-sdk/client/draft/ydb_dynamic_config.h index 8e6ffcc0ad1..5333a66fa78 100644 --- a/include/ydb-cpp-sdk/client/draft/ydb_dynamic_config.h +++ b/include/ydb-cpp-sdk/client/draft/ydb_dynamic_config.h @@ -8,7 +8,7 @@ #include -namespace NYdb::NDynamicConfig { +namespace NYdb::inline V3::NDynamicConfig { struct TGetConfigResult : public TStatus { TGetConfigResult( diff --git a/include/ydb-cpp-sdk/client/draft/ydb_replication.h b/include/ydb-cpp-sdk/client/draft/ydb_replication.h index 3cb919dd856..cfd9e9402f9 100644 --- a/include/ydb-cpp-sdk/client/draft/ydb_replication.h +++ b/include/ydb-cpp-sdk/client/draft/ydb_replication.h @@ -13,11 +13,11 @@ namespace Ydb::Replication { class DescribeReplicationResult_Stats; } -namespace NYdb { +namespace NYdb::inline V3 { class TProtoAccessor; } -namespace NYdb::NReplication { +namespace NYdb::inline V3::NReplication { class TDescribeReplicationResult; using TAsyncDescribeReplicationResult = NThreading::TFuture; @@ -135,7 +135,7 @@ class TReplicationDescription { }; class TDescribeReplicationResult: public NScheme::TDescribePathResult { - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; const Ydb::Replication::DescribeReplicationResult& GetProto() const; public: @@ -160,4 +160,4 @@ class TReplicationClient { std::shared_ptr Impl_; }; -} // namespace NYdb::NReplication +} // namespace NYdb::V3::NReplication diff --git a/include/ydb-cpp-sdk/client/draft/ydb_scripting.h b/include/ydb-cpp-sdk/client/draft/ydb_scripting.h index a921a296185..274d3814907 100644 --- a/include/ydb-cpp-sdk/client/draft/ydb_scripting.h +++ b/include/ydb-cpp-sdk/client/draft/ydb_scripting.h @@ -3,7 +3,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NScripting { class TExecuteYqlResult : public TStatus { diff --git a/include/ydb-cpp-sdk/client/draft/ydb_view.h b/include/ydb-cpp-sdk/client/draft/ydb_view.h index e2318c33be4..7426b03252c 100644 --- a/include/ydb-cpp-sdk/client/draft/ydb_view.h +++ b/include/ydb-cpp-sdk/client/draft/ydb_view.h @@ -7,11 +7,11 @@ namespace Ydb::View { class DescribeViewResult; } -namespace NYdb { +namespace NYdb::inline V3 { class TProtoAccessor; } -namespace NYdb::NView { +namespace NYdb::inline V3::NView { class TDescribeViewResult; using TAsyncDescribeViewResult = NThreading::TFuture; @@ -31,7 +31,7 @@ class TViewDescription { }; class TDescribeViewResult : public NScheme::TDescribePathResult { - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; const Ydb::View::DescribeViewResult& GetProto() const; public: @@ -55,4 +55,4 @@ class TViewClient { std::shared_ptr Impl_; }; -} // namespace NYdb::NView +} // namespace NYdb::V3::NView diff --git a/include/ydb-cpp-sdk/client/driver/driver.h b/include/ydb-cpp-sdk/client/driver/driver.h index 8a1bc503af2..8d9342aac66 100644 --- a/include/ydb-cpp-sdk/client/driver/driver.h +++ b/include/ydb-cpp-sdk/client/driver/driver.h @@ -11,7 +11,7 @@ //////////////////////////////////////////////////////////////////////////////// -namespace NYdb { +namespace NYdb::inline V3 { class TDriver; class TGRpcConnectionsImpl; diff --git a/include/ydb-cpp-sdk/client/export/export.h b/include/ydb-cpp-sdk/client/export/export.h index 61587ae2d74..2f87c880da1 100644 --- a/include/ydb-cpp-sdk/client/export/export.h +++ b/include/ydb-cpp-sdk/client/export/export.h @@ -4,7 +4,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NExport { /// Common diff --git a/include/ydb-cpp-sdk/client/extension_common/extension.h b/include/ydb-cpp-sdk/client/extension_common/extension.h index fde78c96870..23861eecdc7 100644 --- a/include/ydb-cpp-sdk/client/extension_common/extension.h +++ b/include/ydb-cpp-sdk/client/extension_common/extension.h @@ -12,7 +12,7 @@ class ListEndpointsResult; } } -namespace NYdb { +namespace NYdb::inline V3 { class IExtensionApi { public: diff --git a/include/ydb-cpp-sdk/client/extensions/discovery_mutator/discovery_mutator.h b/include/ydb-cpp-sdk/client/extensions/discovery_mutator/discovery_mutator.h index cdffc25ac5f..d82248da25c 100644 --- a/include/ydb-cpp-sdk/client/extensions/discovery_mutator/discovery_mutator.h +++ b/include/ydb-cpp-sdk/client/extensions/discovery_mutator/discovery_mutator.h @@ -2,7 +2,7 @@ #include -namespace NDiscoveryMutator { +namespace NDiscoveryMutator::inline V3 { class TDiscoveryMutator: public NYdb::IExtension { public: @@ -26,4 +26,4 @@ class TDiscoveryMutator: public NYdb::IExtension { } }; -}; // namespace NDiscoveryModifie +} // namespace NDiscoveryMutator diff --git a/include/ydb-cpp-sdk/client/extensions/solomon_stats/pull_client.h b/include/ydb-cpp-sdk/client/extensions/solomon_stats/pull_client.h index 94ccd852a48..c2f1775f6a3 100644 --- a/include/ydb-cpp-sdk/client/extensions/solomon_stats/pull_client.h +++ b/include/ydb-cpp-sdk/client/extensions/solomon_stats/pull_client.h @@ -8,7 +8,7 @@ #include #include -namespace NSolomonStatExtension { +namespace NSolomonStatExtension::inline V3 { class TSolomonStatPullExtension: public NYdb::IExtension { public: diff --git a/include/ydb-cpp-sdk/client/extensions/solomon_stats/pull_connector.h b/include/ydb-cpp-sdk/client/extensions/solomon_stats/pull_connector.h index 46734fab58b..a33121063b9 100644 --- a/include/ydb-cpp-sdk/client/extensions/solomon_stats/pull_connector.h +++ b/include/ydb-cpp-sdk/client/extensions/solomon_stats/pull_connector.h @@ -4,7 +4,7 @@ #include -namespace NSolomonStatExtension { +namespace NSolomonStatExtension::inline V3 { template class TMetricRegistryConnector: public NYdb::IExtension { diff --git a/include/ydb-cpp-sdk/client/federated_topic/federated_topic.h b/include/ydb-cpp-sdk/client/federated_topic/federated_topic.h index f952fd6c541..e1fff416aba 100644 --- a/include/ydb-cpp-sdk/client/federated_topic/federated_topic.h +++ b/include/ydb-cpp-sdk/client/federated_topic/federated_topic.h @@ -8,7 +8,7 @@ #include -namespace NYdb::NFederatedTopic { +namespace NYdb::inline V3::NFederatedTopic { using NTopic::TPrintable; using TDbInfo = Ydb::FederationDiscovery::DatabaseInfo; @@ -525,7 +525,7 @@ class TFederatedTopicClient { } // namespace NYdb::NFederatedTopic -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { using namespace NFederatedTopic; diff --git a/include/ydb-cpp-sdk/client/helpers/helpers.h b/include/ydb-cpp-sdk/client/helpers/helpers.h index ce1a1fd63ca..94357086de3 100644 --- a/include/ydb-cpp-sdk/client/helpers/helpers.h +++ b/include/ydb-cpp-sdk/client/helpers/helpers.h @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { //! Checks the following environment variables and creates TDriverConfig with the first appeared: //! YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS= — service account key file, diff --git a/include/ydb-cpp-sdk/client/iam/common/types.h b/include/ydb-cpp-sdk/client/iam/common/types.h index 0f1cc384d94..8f5fe3dac67 100644 --- a/include/ydb-cpp-sdk/client/iam/common/types.h +++ b/include/ydb-cpp-sdk/client/iam/common/types.h @@ -9,7 +9,6 @@ #include namespace NYdb { - namespace NIam { constexpr std::string_view DEFAULT_ENDPOINT = "iam.api.cloud.yandex.net"; diff --git a/include/ydb-cpp-sdk/client/iam/iam.h b/include/ydb-cpp-sdk/client/iam/iam.h index a79c200dc74..81b41068ca4 100644 --- a/include/ydb-cpp-sdk/client/iam/iam.h +++ b/include/ydb-cpp-sdk/client/iam/iam.h @@ -2,7 +2,7 @@ #include "common/types.h" -namespace NYdb { +namespace NYdb::inline V3 { /// Acquire an IAM token using a local metadata service on a virtual machine. TCredentialsProviderFactoryPtr CreateIamCredentialsProviderFactory(const TIamHost& params = {}); diff --git a/include/ydb-cpp-sdk/client/iam_private/iam.h b/include/ydb-cpp-sdk/client/iam_private/iam.h index 3b2d742d168..c4373c9478a 100644 --- a/include/ydb-cpp-sdk/client/iam_private/iam.h +++ b/include/ydb-cpp-sdk/client/iam_private/iam.h @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { /// Acquire an IAM token using a JSON Web Token (JWT) file name. TCredentialsProviderFactoryPtr CreateIamJwtFileCredentialsProviderFactoryPrivate(const TIamJwtFilename& params); diff --git a/include/ydb-cpp-sdk/client/import/import.h b/include/ydb-cpp-sdk/client/import/import.h index dd2b6a4ceb5..f80b9fd8bd6 100644 --- a/include/ydb-cpp-sdk/client/import/import.h +++ b/include/ydb-cpp-sdk/client/import/import.h @@ -5,7 +5,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NImport { /// Common diff --git a/include/ydb-cpp-sdk/client/monitoring/monitoring.h b/include/ydb-cpp-sdk/client/monitoring/monitoring.h index 77799e8d8cd..f8dfc279941 100644 --- a/include/ydb-cpp-sdk/client/monitoring/monitoring.h +++ b/include/ydb-cpp-sdk/client/monitoring/monitoring.h @@ -8,7 +8,7 @@ namespace Monitoring { } } -namespace NYdb { +namespace NYdb::inline V3 { class TProtoAccessor; @@ -33,7 +33,7 @@ struct TSelfCheckSettings : public TOperationRequestSettings }; class TSelfCheckResult : public TStatus { - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; public: TSelfCheckResult(TStatus&& status, Ydb::Monitoring::SelfCheckResult&& result); private: diff --git a/include/ydb-cpp-sdk/client/operation/operation.h b/include/ydb-cpp-sdk/client/operation/operation.h index 314b9879aa9..6416f6cc81b 100644 --- a/include/ydb-cpp-sdk/client/operation/operation.h +++ b/include/ydb-cpp-sdk/client/operation/operation.h @@ -3,7 +3,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NOperation { template diff --git a/include/ydb-cpp-sdk/client/params/params.h b/include/ydb-cpp-sdk/client/params/params.h index d7f72bcc4be..1092c2bb880 100644 --- a/include/ydb-cpp-sdk/client/params/params.h +++ b/include/ydb-cpp-sdk/client/params/params.h @@ -9,7 +9,7 @@ namespace Ydb { class TypedValue; } -namespace NYdb { +namespace NYdb::inline V3 { namespace NScripting { class TScriptingClient; @@ -43,7 +43,7 @@ class TParams { friend class NExperimental::TStreamQueryClient; friend class NQuery::TExecQueryImpl; friend class NQuery::TQueryClient; - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; public: bool Empty() const; diff --git a/include/ydb-cpp-sdk/client/proto/accessor.h b/include/ydb-cpp-sdk/client/proto/accessor.h index e2ff8c75897..cee4869a985 100644 --- a/include/ydb-cpp-sdk/client/proto/accessor.h +++ b/include/ydb-cpp-sdk/client/proto/accessor.h @@ -19,7 +19,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { class TResultSet; class TValue; diff --git a/include/ydb-cpp-sdk/client/query/client.h b/include/ydb-cpp-sdk/client/query/client.h index 08eb754f08d..d608b18f674 100644 --- a/include/ydb-cpp-sdk/client/query/client.h +++ b/include/ydb-cpp-sdk/client/query/client.h @@ -8,7 +8,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { class TProtoAccessor; namespace NRetry::Async { @@ -21,7 +21,7 @@ namespace NYdb { } // namespace NRetry::Sync } -namespace NYdb::NQuery { +namespace NYdb::inline V3::NQuery { struct TCreateSessionSettings : public TSimpleRequestSettings { TCreateSessionSettings(); @@ -264,4 +264,4 @@ class TExecuteQueryResult : public TStatus { std::optional Transaction_; }; -} // namespace NYdb::NQuery +} // namespace NYdb::V3::NQuery diff --git a/include/ydb-cpp-sdk/client/query/query.h b/include/ydb-cpp-sdk/client/query/query.h index 959d22e0321..6ecc64393d1 100644 --- a/include/ydb-cpp-sdk/client/query/query.h +++ b/include/ydb-cpp-sdk/client/query/query.h @@ -10,7 +10,7 @@ #include -namespace NYdb::NQuery { +namespace NYdb::inline V3::NQuery { enum class ESyntax { Unspecified = 0, @@ -186,4 +186,4 @@ class TExecuteQueryResult; using TAsyncFetchScriptResultsResult = NThreading::TFuture; using TAsyncExecuteQueryResult = NThreading::TFuture; -} // namespace NYdb::NQuery +} // namespace NYdb::V3::NQuery diff --git a/include/ydb-cpp-sdk/client/query/stats.h b/include/ydb-cpp-sdk/client/query/stats.h index 617cbd976c5..92856ba1ebc 100644 --- a/include/ydb-cpp-sdk/client/query/stats.h +++ b/include/ydb-cpp-sdk/client/query/stats.h @@ -12,14 +12,14 @@ namespace Ydb::TableStats { class QueryStats; } -namespace NYdb { +namespace NYdb::inline V3 { class TProtoAccessor; } -namespace NYdb::NQuery { +namespace NYdb::inline V3::NQuery { class TExecStats { - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; public: TExecStats() = default; @@ -43,4 +43,4 @@ class TExecStats { std::shared_ptr Impl_; }; -} // namespace NYdb::NQuery +} // namespace NYdb::V3::NQuery diff --git a/include/ydb-cpp-sdk/client/query/tx.h b/include/ydb-cpp-sdk/client/query/tx.h index c73e0b8c1d9..aad7684cf92 100644 --- a/include/ydb-cpp-sdk/client/query/tx.h +++ b/include/ydb-cpp-sdk/client/query/tx.h @@ -6,7 +6,7 @@ #include -namespace NYdb::NQuery { +namespace NYdb::inline V3::NQuery { struct TTxOnlineSettings { using TSelf = TTxOnlineSettings; @@ -108,4 +108,4 @@ struct TTxControl { : TxSettings_(txSettings) {} }; -} // namespace NYdb::NQuery +} // namespace NYdb::V3::NQuery diff --git a/include/ydb-cpp-sdk/client/rate_limiter/rate_limiter.h b/include/ydb-cpp-sdk/client/rate_limiter/rate_limiter.h index 406776c0928..040e65f8f77 100644 --- a/include/ydb-cpp-sdk/client/rate_limiter/rate_limiter.h +++ b/include/ydb-cpp-sdk/client/rate_limiter/rate_limiter.h @@ -7,7 +7,7 @@ class DescribeResourceResult; class HierarchicalDrrSettings; } // namespace Ydb::RateLimiter -namespace NYdb::NRateLimiter { +namespace NYdb::inline V3::NRateLimiter { // Settings for hierarchical deficit round robin (HDRR) algorithm. template @@ -171,4 +171,4 @@ class TRateLimiterClient { std::shared_ptr Impl_; }; -} // namespace NYdb::NRateLimiter +} // namespace NYdb::V3::NRateLimiter diff --git a/include/ydb-cpp-sdk/client/resources/ydb_ca.h b/include/ydb-cpp-sdk/client/resources/ydb_ca.h index 05add5c68b1..e3b3bf055b9 100644 --- a/include/ydb-cpp-sdk/client/resources/ydb_ca.h +++ b/include/ydb-cpp-sdk/client/resources/ydb_ca.h @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { std::string GetRootCertificate(); diff --git a/include/ydb-cpp-sdk/client/resources/ydb_resources.h b/include/ydb-cpp-sdk/client/resources/ydb_resources.h index d57980400d8..02a8e26681b 100644 --- a/include/ydb-cpp-sdk/client/resources/ydb_resources.h +++ b/include/ydb-cpp-sdk/client/resources/ydb_resources.h @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { extern const char* YDB_AUTH_TICKET_HEADER; extern const char* YDB_DATABASE_HEADER; diff --git a/include/ydb-cpp-sdk/client/result/result.h b/include/ydb-cpp-sdk/client/result/result.h index b8ed9091105..d7caa0249e4 100644 --- a/include/ydb-cpp-sdk/client/result/result.h +++ b/include/ydb-cpp-sdk/client/result/result.h @@ -8,7 +8,7 @@ namespace Ydb { class ResultSet; } -namespace NYdb { +namespace NYdb::inline V3 { class TProtoAccessor; @@ -30,7 +30,7 @@ bool operator!=(const TColumn& col1, const TColumn& col2); //! Collection of rows, represents result of query or part of the result in case of stream operations class TResultSet { friend class TResultSetParser; - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; public: TResultSet(const Ydb::ResultSet& proto); TResultSet(Ydb::ResultSet&& proto); diff --git a/include/ydb-cpp-sdk/client/retry/retry.h b/include/ydb-cpp-sdk/client/retry/retry.h index 36bbd23a8f6..748bd3a4bf7 100644 --- a/include/ydb-cpp-sdk/client/retry/retry.h +++ b/include/ydb-cpp-sdk/client/retry/retry.h @@ -3,7 +3,7 @@ #include #include -namespace NYdb::NRetry { +namespace NYdb::inline V3::NRetry { struct TBackoffSettings { using TSelf = TBackoffSettings; @@ -41,4 +41,4 @@ struct TRetryOperationSettings { } }; -} // namespace NYdb::NRetry +} // namespace NYdb::V3::NRetry diff --git a/include/ydb-cpp-sdk/client/scheme/scheme.h b/include/ydb-cpp-sdk/client/scheme/scheme.h index cec51105ae0..1351d61875d 100644 --- a/include/ydb-cpp-sdk/client/scheme/scheme.h +++ b/include/ydb-cpp-sdk/client/scheme/scheme.h @@ -11,7 +11,7 @@ namespace Ydb { } } -namespace NYdb { +namespace NYdb::inline V3 { namespace NScheme { //////////////////////////////////////////////////////////////////////////////// diff --git a/include/ydb-cpp-sdk/client/table/query_stats/stats.h b/include/ydb-cpp-sdk/client/table/query_stats/stats.h index 00a1192a6cd..38740d2dd13 100644 --- a/include/ydb-cpp-sdk/client/table/query_stats/stats.h +++ b/include/ydb-cpp-sdk/client/table/query_stats/stats.h @@ -14,7 +14,7 @@ namespace Ydb { } } -namespace NYdb { +namespace NYdb::inline V3 { class TProtoAccessor; diff --git a/include/ydb-cpp-sdk/client/table/table.h b/include/ydb-cpp-sdk/client/table/table.h index 69503ff1ad1..03832a2097f 100644 --- a/include/ydb-cpp-sdk/client/table/table.h +++ b/include/ydb-cpp-sdk/client/table/table.h @@ -38,7 +38,7 @@ class ValueSinceUnixEpochModeSettingsV1; } // namespace Table } // namespace Ydb -namespace NYdb { +namespace NYdb::inline V3 { namespace NRetry::Async { template @@ -269,7 +269,7 @@ struct TKMeansTreeSettings { //! Represents index description class TIndexDescription { - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; public: TIndexDescription( @@ -346,7 +346,7 @@ class TBuildIndexOperation : public TOperation { //! Represents changefeed description class TChangefeedDescription { - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; public: class TInitialScanProgress { @@ -395,9 +395,13 @@ class TChangefeedDescription { const std::optional& GetInitialScanProgress() const; void SerializeTo(Ydb::Table::Changefeed& proto) const; + void SerializeTo(Ydb::Table::ChangefeedDescription& proto) const; std::string ToString() const; void Out(IOutputStream& o) const; + template + void SerializeCommonFields(TProto& proto) const; + private: explicit TChangefeedDescription(const Ydb::Table::Changefeed& proto); explicit TChangefeedDescription(const Ydb::Table::ChangefeedDescription& proto); @@ -651,7 +655,7 @@ enum class EStoreType { //! Represents table description class TTableDescription { friend class TTableBuilder; - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; using EUnit = TValueSinceUnixEpochModeSettings::EUnit; @@ -1098,8 +1102,8 @@ using TAsyncScanQueryPartIterator = NThreading::TFuture; struct TCreateSessionSettings : public TOperationRequestSettings {}; -using TBackoffSettings = NYdb::NRetry::TBackoffSettings; -using TRetryOperationSettings = NYdb::NRetry::TRetryOperationSettings; +using TBackoffSettings = NYdb::V3::NRetry::TBackoffSettings; +using TRetryOperationSettings = NYdb::V3::NRetry::TRetryOperationSettings; struct TSessionPoolSettings { using TSelf = TSessionPoolSettings; diff --git a/include/ydb-cpp-sdk/client/table/table_enum.h b/include/ydb-cpp-sdk/client/table/table_enum.h index 1660706f57a..7c5197a84db 100644 --- a/include/ydb-cpp-sdk/client/table/table_enum.h +++ b/include/ydb-cpp-sdk/client/table/table_enum.h @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NTable { //! Column family compression codec diff --git a/include/ydb-cpp-sdk/client/topic/client.h b/include/ydb-cpp-sdk/client/topic/client.h index d8f8cb92bc1..1b1ea70c807 100644 --- a/include/ydb-cpp-sdk/client/topic/client.h +++ b/include/ydb-cpp-sdk/client/topic/client.h @@ -4,7 +4,7 @@ #include "read_session.h" #include "write_session.h" -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { struct TTopicClientSettings : public TCommonClientSettingsBase { using TSelf = TTopicClientSettings; @@ -61,4 +61,4 @@ class TTopicClient { std::shared_ptr Impl_; }; -} // namespace NYdb::NTopic +} // namespace NYdb::V3::NTopic diff --git a/include/ydb-cpp-sdk/client/topic/codecs.h b/include/ydb-cpp-sdk/client/topic/codecs.h index a1e2e288da7..a91c87afee1 100644 --- a/include/ydb-cpp-sdk/client/topic/codecs.h +++ b/include/ydb-cpp-sdk/client/topic/codecs.h @@ -11,7 +11,7 @@ #include #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { enum class ECodec : uint32_t { RAW = 1, @@ -93,4 +93,4 @@ class TCodecMap { TAdaptiveLock Lock; }; -} // namespace NYdb::NTopic +} // namespace NYdb::V3::NTopic diff --git a/include/ydb-cpp-sdk/client/topic/control_plane.h b/include/ydb-cpp-sdk/client/topic/control_plane.h index 42e4b840529..4e25523f9e9 100644 --- a/include/ydb-cpp-sdk/client/topic/control_plane.h +++ b/include/ydb-cpp-sdk/client/topic/control_plane.h @@ -10,7 +10,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { class TProtoAccessor; namespace NScheme { @@ -18,7 +18,7 @@ namespace NYdb { } } -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { enum class EMeteringMode : uint32_t { Unspecified = 0, @@ -108,12 +108,18 @@ class TPartitionConsumerStats { uint64_t GetLastReadOffset() const; std::string GetReaderName() const; std::string GetReadSessionId() const; + const TInstant& GetLastReadTime() const; + const TDuration& GetMaxReadTimeLag() const; + const TDuration& GetMaxWriteTimeLag() const; private: uint64_t CommittedOffset_; int64_t LastReadOffset_; std::string ReaderName_; std::string ReadSessionId_; + TInstant LastReadTime_; + TDuration MaxReadTimeLag_; + TDuration MaxWriteTimeLag_; }; // Topic partition location @@ -257,7 +263,7 @@ struct TAlterPartitioningSettings { }; class TTopicDescription { - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; public: TTopicDescription(Ydb::Topic::DescribeTopicResult&& desc); @@ -320,7 +326,7 @@ class TTopicDescription { }; class TConsumerDescription { - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; public: TConsumerDescription(Ydb::Topic::DescribeConsumerResult&& desc); @@ -340,7 +346,7 @@ class TConsumerDescription { }; class TPartitionDescription { - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; public: TPartitionDescription(Ydb::Topic::DescribePartitionResult&& desc); @@ -355,7 +361,7 @@ class TPartitionDescription { // Result for describe topic request. struct TDescribeTopicResult : public TStatus { - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; TDescribeTopicResult(TStatus&& status, Ydb::Topic::DescribeTopicResult&& result); @@ -367,7 +373,7 @@ struct TDescribeTopicResult : public TStatus { // Result for describe consumer request. struct TDescribeConsumerResult : public TStatus { - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; TDescribeConsumerResult(TStatus&& status, Ydb::Topic::DescribeConsumerResult&& result); @@ -379,7 +385,7 @@ struct TDescribeConsumerResult : public TStatus { // Result for describe partition request. struct TDescribePartitionResult: public TStatus { - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; TDescribePartitionResult(TStatus&& status, Ydb::Topic::DescribePartitionResult&& result); @@ -750,4 +756,4 @@ struct TDescribePartitionSettings: public TOperationRequestSettings {}; -} // namespace NYdb::NTopic +} // namespace NYdb::V3::NTopic diff --git a/include/ydb-cpp-sdk/client/topic/counters.h b/include/ydb-cpp-sdk/client/topic/counters.h index 8d44dc131c2..69568c3e177 100644 --- a/include/ydb-cpp-sdk/client/topic/counters.h +++ b/include/ydb-cpp-sdk/client/topic/counters.h @@ -2,7 +2,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { using TCounterPtr = ::NMonitoring::TDynamicCounters::TCounterPtr; @@ -169,4 +169,4 @@ inline bool HasNullCounters(TReaderCounters& counters) { #undef TOPIC_COUNTERS_HISTOGRAM_SETUP -} // namespace NYdb::NTopic +} // namespace NYdb::V3::NTopic diff --git a/include/ydb-cpp-sdk/client/topic/errors.h b/include/ydb-cpp-sdk/client/topic/errors.h index e8790061c76..e36a820fe1c 100644 --- a/include/ydb-cpp-sdk/client/topic/errors.h +++ b/include/ydb-cpp-sdk/client/topic/errors.h @@ -5,9 +5,9 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { ERetryErrorClass GetRetryErrorClass(EStatus status); ERetryErrorClass GetRetryErrorClassV2(EStatus status); -} // namespace NYdb::NTopic +} // namespace NYdb::V3::NTopic diff --git a/include/ydb-cpp-sdk/client/topic/events_common.h b/include/ydb-cpp-sdk/client/topic/events_common.h index 384bc435239..07556592415 100644 --- a/include/ydb-cpp-sdk/client/topic/events_common.h +++ b/include/ydb-cpp-sdk/client/topic/events_common.h @@ -5,7 +5,7 @@ #include #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { template class TPrintable { diff --git a/include/ydb-cpp-sdk/client/topic/executor.h b/include/ydb-cpp-sdk/client/topic/executor.h index 23484dc79ac..cb9201d3c6e 100644 --- a/include/ydb-cpp-sdk/client/topic/executor.h +++ b/include/ydb-cpp-sdk/client/topic/executor.h @@ -7,7 +7,7 @@ #include #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { class IExecutor: public TThrRefBase { public: diff --git a/include/ydb-cpp-sdk/client/topic/read_events.h b/include/ydb-cpp-sdk/client/topic/read_events.h index cf967edf1e6..81f0d88dd15 100644 --- a/include/ydb-cpp-sdk/client/topic/read_events.h +++ b/include/ydb-cpp-sdk/client/topic/read_events.h @@ -5,7 +5,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { //! Partition session. struct TPartitionSession: public TThrRefBase, public TPrintable { diff --git a/include/ydb-cpp-sdk/client/topic/read_session.h b/include/ydb-cpp-sdk/client/topic/read_session.h index 889850417f7..696d3f01f02 100644 --- a/include/ydb-cpp-sdk/client/topic/read_session.h +++ b/include/ydb-cpp-sdk/client/topic/read_session.h @@ -13,11 +13,11 @@ #include -namespace NYdb::NTable { +namespace NYdb::inline V3::NTable { class TTransaction; } -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { //! Read settings for single topic. struct TTopicReadSettings { diff --git a/include/ydb-cpp-sdk/client/topic/retry_policy.h b/include/ydb-cpp-sdk/client/topic/retry_policy.h index 8aef9f3556a..3460a5659ed 100644 --- a/include/ydb-cpp-sdk/client/topic/retry_policy.h +++ b/include/ydb-cpp-sdk/client/topic/retry_policy.h @@ -4,7 +4,7 @@ #include #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { //! Retry policy. //! Calculates delay before next retry. @@ -38,4 +38,4 @@ struct IRetryPolicy: ::IRetryPolicy { std::function customRetryClassFunction = {}); }; -} // namespace NYdb::NTopic +} // namespace NYdb::V3::NTopic diff --git a/include/ydb-cpp-sdk/client/topic/write_events.h b/include/ydb-cpp-sdk/client/topic/write_events.h index 46d195f688a..49b7bb1ded2 100644 --- a/include/ydb-cpp-sdk/client/topic/write_events.h +++ b/include/ydb-cpp-sdk/client/topic/write_events.h @@ -7,7 +7,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { struct TWriteStat : public TThrRefBase { TDuration WriteTime; diff --git a/include/ydb-cpp-sdk/client/topic/write_session.h b/include/ydb-cpp-sdk/client/topic/write_session.h index 45e995a2359..585e32f13c0 100644 --- a/include/ydb-cpp-sdk/client/topic/write_session.h +++ b/include/ydb-cpp-sdk/client/topic/write_session.h @@ -11,11 +11,11 @@ #include -namespace NYdb::NTable { +namespace NYdb::inline V3::NTable { class TTransaction; } -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { using TTransaction = NTable::TTransaction; diff --git a/include/ydb-cpp-sdk/client/types/credentials/credentials.h b/include/ydb-cpp-sdk/client/types/credentials/credentials.h index b858888cf69..a70dbeeb0bd 100644 --- a/include/ydb-cpp-sdk/client/types/credentials/credentials.h +++ b/include/ydb-cpp-sdk/client/types/credentials/credentials.h @@ -3,7 +3,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { class ICredentialsProvider { public: diff --git a/include/ydb-cpp-sdk/client/types/credentials/oauth2_token_exchange/credentials.h b/include/ydb-cpp-sdk/client/types/credentials/oauth2_token_exchange/credentials.h index 3c6017cb71e..e0593ab06e8 100644 --- a/include/ydb-cpp-sdk/client/types/credentials/oauth2_token_exchange/credentials.h +++ b/include/ydb-cpp-sdk/client/types/credentials/oauth2_token_exchange/credentials.h @@ -7,7 +7,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { class ITokenSource { public: diff --git a/include/ydb-cpp-sdk/client/types/credentials/oauth2_token_exchange/from_file.h b/include/ydb-cpp-sdk/client/types/credentials/oauth2_token_exchange/from_file.h index b887cca5880..621425d47ec 100644 --- a/include/ydb-cpp-sdk/client/types/credentials/oauth2_token_exchange/from_file.h +++ b/include/ydb-cpp-sdk/client/types/credentials/oauth2_token_exchange/from_file.h @@ -5,7 +5,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { // Lists supported algorithms for creation of OAuth 2.0 token exchange provider via config file std::vector GetSupportedOauth2TokenExchangeJwtAlgorithms(); diff --git a/include/ydb-cpp-sdk/client/types/credentials/oauth2_token_exchange/jwt_token_source.h b/include/ydb-cpp-sdk/client/types/credentials/oauth2_token_exchange/jwt_token_source.h index 674203eb3c8..0660708e724 100644 --- a/include/ydb-cpp-sdk/client/types/credentials/oauth2_token_exchange/jwt_token_source.h +++ b/include/ydb-cpp-sdk/client/types/credentials/oauth2_token_exchange/jwt_token_source.h @@ -6,7 +6,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { constexpr TDuration DEFAULT_JWT_TOKEN_TTL = TDuration::Hours(1); diff --git a/include/ydb-cpp-sdk/client/types/exceptions/exceptions.h b/include/ydb-cpp-sdk/client/types/exceptions/exceptions.h index cd3c51bb857..b296db2429c 100644 --- a/include/ydb-cpp-sdk/client/types/exceptions/exceptions.h +++ b/include/ydb-cpp-sdk/client/types/exceptions/exceptions.h @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { class TYdbException : public yexception { public: diff --git a/include/ydb-cpp-sdk/client/types/fatal_error_handlers/handlers.h b/include/ydb-cpp-sdk/client/types/fatal_error_handlers/handlers.h index a931b807005..a36e083895b 100644 --- a/include/ydb-cpp-sdk/client/types/fatal_error_handlers/handlers.h +++ b/include/ydb-cpp-sdk/client/types/fatal_error_handlers/handlers.h @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { void ThrowFatalError(const std::string& str); diff --git a/include/ydb-cpp-sdk/client/types/operation/operation.h b/include/ydb-cpp-sdk/client/types/operation/operation.h index 88d226d2aab..893a5f4ebc8 100644 --- a/include/ydb-cpp-sdk/client/types/operation/operation.h +++ b/include/ydb-cpp-sdk/client/types/operation/operation.h @@ -16,7 +16,7 @@ class Operation; } // namespace Operations } // namespace Ydb -namespace NYdb { +namespace NYdb::inline V3 { class TStatus; diff --git a/include/ydb-cpp-sdk/client/types/request_settings.h b/include/ydb-cpp-sdk/client/types/request_settings.h index 9543616ca52..d62730bcb95 100644 --- a/include/ydb-cpp-sdk/client/types/request_settings.h +++ b/include/ydb-cpp-sdk/client/types/request_settings.h @@ -7,7 +7,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { template struct TRequestSettings { diff --git a/include/ydb-cpp-sdk/client/types/s3_settings.h b/include/ydb-cpp-sdk/client/types/s3_settings.h index 66cb1530419..6f5430a5fe1 100644 --- a/include/ydb-cpp-sdk/client/types/s3_settings.h +++ b/include/ydb-cpp-sdk/client/types/s3_settings.h @@ -4,7 +4,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { enum class ES3Scheme { HTTP = 1 /* "http" */, diff --git a/include/ydb-cpp-sdk/client/types/status/status.h b/include/ydb-cpp-sdk/client/types/status/status.h index d95feeb51a5..41af8ffb667 100644 --- a/include/ydb-cpp-sdk/client/types/status/status.h +++ b/include/ydb-cpp-sdk/client/types/status/status.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include @@ -7,7 +8,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { //! Internal status representation struct TPlainStatus; @@ -45,4 +46,27 @@ class TStreamPartStatus : public TStatus { bool EOS() const; }; +namespace NStatusHelpers { + +class TYdbErrorException : public TYdbException { +public: + TYdbErrorException(TStatus status) + : Status_(std::move(status)) + { + *this << status; + } + + friend IOutputStream& operator<<(IOutputStream& out, const TYdbErrorException& e) { + return out << e.Status_; + } + +private: + TStatus Status_; +}; + +void ThrowOnError(TStatus status, std::function onSuccess = [](TStatus) {}); +void ThrowOnErrorOrPrintIssues(TStatus status); + +} + } // namespace NYdb diff --git a/include/ydb-cpp-sdk/client/types/status_codes.h b/include/ydb-cpp-sdk/client/types/status_codes.h index d6c34651e27..15aedc57b77 100644 --- a/include/ydb-cpp-sdk/client/types/status_codes.h +++ b/include/ydb-cpp-sdk/client/types/status_codes.h @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { constexpr size_t TRANSPORT_STATUSES_FIRST = 401000; constexpr size_t TRANSPORT_STATUSES_LAST = 401999; diff --git a/include/ydb-cpp-sdk/client/types/ydb.h b/include/ydb-cpp-sdk/client/types/ydb.h index 2321d94c2a0..e0c85f8b65d 100644 --- a/include/ydb-cpp-sdk/client/types/ydb.h +++ b/include/ydb-cpp-sdk/client/types/ydb.h @@ -2,7 +2,7 @@ #include "status_codes.h" -namespace NYdb { +namespace NYdb::inline V3 { enum class EDiscoveryMode { //! Block in ctor (driver or client if database and/or auth token is overridden by client settings) diff --git a/include/ydb-cpp-sdk/client/value/value.h b/include/ydb-cpp-sdk/client/value/value.h index c9f300adea1..f198d54f68e 100644 --- a/include/ydb-cpp-sdk/client/value/value.h +++ b/include/ydb-cpp-sdk/client/value/value.h @@ -10,7 +10,7 @@ namespace Ydb { class Value; } -namespace NYdb { +namespace NYdb::inline V3 { class TResultSetParser; diff --git a/src/api/protos/ydb_cms.proto b/src/api/protos/ydb_cms.proto index 29e8b3f596b..806bb63bb52 100644 --- a/src/api/protos/ydb_cms.proto +++ b/src/api/protos/ydb_cms.proto @@ -4,6 +4,7 @@ option cc_enable_arenas = true; package Ydb.Cms; option java_package = "com.yandex.ydb.cms"; +import "src/api/protos/annotations/validation.proto"; import "src/api/protos/ydb_issue_message.proto"; import "src/api/protos/ydb_operation.proto"; import "src/api/protos/ydb_status_codes.proto"; @@ -115,7 +116,7 @@ message ScaleRecommenderPolicies { message TargetTrackingPolicy { oneof target { // A percentage of compute resources' average CPU utilization. - uint32 average_cpu_utilization_percent = 1; + uint32 average_cpu_utilization_percent = 1 [(Ydb.value) = "[10; 90]"]; } } diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index 736310d2239..65426eeaccd 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -1,3 +1,4 @@ +add_subdirectory(bsconfig) add_subdirectory(draft) add_subdirectory(helpers) add_subdirectory(iam) diff --git a/src/client/bsconfig/CMakeLists.txt b/src/client/bsconfig/CMakeLists.txt new file mode 100644 index 00000000000..961a3327a60 --- /dev/null +++ b/src/client/bsconfig/CMakeLists.txt @@ -0,0 +1,20 @@ +_ydb_sdk_add_library(client-bsconfig) + +target_link_libraries(client-bsconfig + PUBLIC + client-ydb_driver + client-ydb_common_client + client-ydb_types-status + client-ydb_types + PRIVATE + api-grpc + impl-ydb_internal-make_request + client-ydb_common_client-impl +) + +target_sources(client-bsconfig + PRIVATE + storage_config.cpp +) + +_ydb_sdk_make_client_component(BSConfig client-bsconfig) diff --git a/src/client/bsconfig/storage_config.cpp b/src/client/bsconfig/storage_config.cpp new file mode 100644 index 00000000000..3f729eaa4d1 --- /dev/null +++ b/src/client/bsconfig/storage_config.cpp @@ -0,0 +1,67 @@ +#include + +#include +#include + +#include + +namespace NYdb::inline V3::NStorageConfig { + +class TStorageConfigClient::TImpl : public TClientImplCommon { +public: + TImpl(std::shared_ptr connections, const TCommonClientSettings& settings) + : TClientImplCommon(std::move(connections), settings) + { + } + + TAsyncStatus ReplaceStorageConfig(const std::string& config) { + auto request = MakeRequest(); + request.set_yaml_config(config); + + return RunSimple( + std::move(request), + &Ydb::BSConfig::V1::BSConfigService::Stub::AsyncReplaceStorageConfig); + } + + TAsyncFetchStorageConfigResult FetchStorageConfig(const TStorageConfigSettings& settings = {}) { + auto request = MakeOperationRequest(settings); + auto promise = NThreading::NewPromise(); + + auto extractor = [promise] (google::protobuf::Any* any, TPlainStatus status) mutable { + NYdb::TStringType config; + if (Ydb::BSConfig::FetchStorageConfigResult result; any && any->UnpackTo(&result)) { + config = result.yaml_config(); + } + + TFetchStorageConfigResult val(TStatus(std::move(status)), std::string{std::move(config)}); + promise.SetValue(std::move(val)); + }; + + Connections_->RunDeferred( + std::move(request), + extractor, + &Ydb::BSConfig::V1::BSConfigService::Stub::AsyncFetchStorageConfig, + DbDriverState_, + INITIAL_DEFERRED_CALL_DELAY, + TRpcRequestSettings::Make(settings)); + return promise.GetFuture(); + } + +}; + +TStorageConfigClient::TStorageConfigClient(const TDriver& driver, const TCommonClientSettings& settings) + : Impl_(new TStorageConfigClient::TImpl(CreateInternalInterface(driver), settings)) +{} + +TStorageConfigClient::~TStorageConfigClient() = default; + +TAsyncStatus TStorageConfigClient::ReplaceStorageConfig(const std::string& config) { + return Impl_->ReplaceStorageConfig(config); +} + +TAsyncFetchStorageConfigResult TStorageConfigClient::FetchStorageConfig(const TStorageConfigSettings& settings) { + return Impl_->FetchStorageConfig(settings); +} + + +} diff --git a/src/client/common_client/impl/client.h b/src/client/common_client/impl/client.h index 41cee29a980..a24667204cc 100644 --- a/src/client/common_client/impl/client.h +++ b/src/client/common_client/impl/client.h @@ -11,7 +11,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { template class TClientImplCommon diff --git a/src/client/common_client/impl/iface.h b/src/client/common_client/impl/iface.h index 2f0e3105996..87b6ad6472a 100644 --- a/src/client/common_client/impl/iface.h +++ b/src/client/common_client/impl/iface.h @@ -3,7 +3,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { class IClientImplCommon { public: diff --git a/src/client/common_client/settings.cpp b/src/client/common_client/settings.cpp index 166b139b52e..d8928a566f5 100644 --- a/src/client/common_client/settings.cpp +++ b/src/client/common_client/settings.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { TCommonClientSettings& TCommonClientSettings::AuthToken(const std::optional& token) { return CredentialsProviderFactory(CreateOAuthCredentialsProviderFactory(token.value())); diff --git a/src/client/coordination/coordination.cpp b/src/client/coordination/coordination.cpp index 1fba2be26b9..f141a58a7e1 100644 --- a/src/client/coordination/coordination.cpp +++ b/src/client/coordination/coordination.cpp @@ -11,7 +11,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NCoordination { using NThreading::TFuture; diff --git a/src/client/coordination/proto_accessor.cpp b/src/client/coordination/proto_accessor.cpp index de2ebf83700..c6a1051d42d 100644 --- a/src/client/coordination/proto_accessor.cpp +++ b/src/client/coordination/proto_accessor.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { const Ydb::Coordination::DescribeNodeResult& TProtoAccessor::GetProto(const NCoordination::TNodeDescription& nodeDescription) { return nodeDescription.GetProto(); diff --git a/src/client/datastreams/datastreams.cpp b/src/client/datastreams/datastreams.cpp index 31cfdea4ca9..d7c571ef67c 100644 --- a/src/client/datastreams/datastreams.cpp +++ b/src/client/datastreams/datastreams.cpp @@ -11,7 +11,7 @@ #include -namespace NYdb::NDataStreams::V1 { +namespace NYdb::inline V3::NDataStreams::V1 { TPartitioningSettingsBuilder TCreateStreamSettings::BeginConfigurePartitioningSettings() { return { *this }; diff --git a/src/client/debug/client.cpp b/src/client/debug/client.cpp index 383d6e7737e..e3542e36338 100644 --- a/src/client/debug/client.cpp +++ b/src/client/debug/client.cpp @@ -10,7 +10,7 @@ #include -namespace NYdb::NDebug { +namespace NYdb::inline V3::NDebug { using namespace Ydb; diff --git a/src/client/discovery/discovery.cpp b/src/client/discovery/discovery.cpp index 2295886e5c2..c3c97d435fb 100644 --- a/src/client/discovery/discovery.cpp +++ b/src/client/discovery/discovery.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NDiscovery { TListEndpointsResult::TListEndpointsResult(TStatus&& status, const Ydb::Discovery::ListEndpointsResult& proto) diff --git a/src/client/draft/ydb_dynamic_config.cpp b/src/client/draft/ydb_dynamic_config.cpp index aab5d7b5d48..315bbe3adec 100644 --- a/src/client/draft/ydb_dynamic_config.cpp +++ b/src/client/draft/ydb_dynamic_config.cpp @@ -4,7 +4,7 @@ #include #include -namespace NYdb::NDynamicConfig { +namespace NYdb::inline V3::NDynamicConfig { class TDynamicConfigClient::TImpl : public TClientImplCommon { public: @@ -431,4 +431,4 @@ TAsyncVerboseResolveConfigResult TDynamicConfigClient::VerboseResolveConfig( return Impl_->VerboseResolveConfig(config, volatileConfigs, settings); } -} // namespace NYdb::NDynamicConfig +} // namespace NYdb::V3::NDynamicConfig diff --git a/src/client/draft/ydb_replication.cpp b/src/client/draft/ydb_replication.cpp index ced46984194..66e5a001074 100644 --- a/src/client/draft/ydb_replication.cpp +++ b/src/client/draft/ydb_replication.cpp @@ -13,7 +13,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NReplication { TConnectionParams::TConnectionParams(const Ydb::Replication::ConnectionParams& params) { diff --git a/src/client/draft/ydb_scripting.cpp b/src/client/draft/ydb_scripting.cpp index 8c99a857d7f..e785b318362 100644 --- a/src/client/draft/ydb_scripting.cpp +++ b/src/client/draft/ydb_scripting.cpp @@ -9,7 +9,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NScripting { using namespace NThreading; diff --git a/src/client/draft/ydb_view.cpp b/src/client/draft/ydb_view.cpp index 1afd5440bf0..75fa55606bb 100644 --- a/src/client/draft/ydb_view.cpp +++ b/src/client/draft/ydb_view.cpp @@ -9,7 +9,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NView { TViewDescription::TViewDescription(const Ydb::View::DescribeViewResult& desc) diff --git a/src/client/driver/driver.cpp b/src/client/driver/driver.cpp index 009852d563b..af4e96a2779 100644 --- a/src/client/driver/driver.cpp +++ b/src/client/driver/driver.cpp @@ -13,7 +13,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { using NYdbGrpc::TGRpcClientLow; using NYdbGrpc::TServiceConnection; diff --git a/src/client/export/export.cpp b/src/client/export/export.cpp index 8760903181a..bbff6e1020a 100644 --- a/src/client/export/export.cpp +++ b/src/client/export/export.cpp @@ -15,7 +15,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NExport { using namespace NThreading; diff --git a/src/client/extension_common/extension.cpp b/src/client/extension_common/extension.cpp index db0dc29b468..5ad050e1d1f 100644 --- a/src/client/extension_common/extension.cpp +++ b/src/client/extension_common/extension.cpp @@ -5,7 +5,7 @@ #include #undef INCLUDE_YDB_INTERNAL_H -namespace NYdb { +namespace NYdb::inline V3 { void IExtension::SelfRegister(TDriver driver) { CreateInternalInterface(driver)->RegisterExtension(this); diff --git a/src/client/extensions/solomon_stats/pull_client.cpp b/src/client/extensions/solomon_stats/pull_client.cpp index 742d09d4a5d..fbb6129061a 100644 --- a/src/client/extensions/solomon_stats/pull_client.cpp +++ b/src/client/extensions/solomon_stats/pull_client.cpp @@ -1,6 +1,6 @@ #include -namespace NSolomonStatExtension { +namespace NSolomonStatExtension::inline V3 { TSolomonStatPullExtension::TParams::TParams(const std::string& host , ui16 port diff --git a/src/client/federated_topic/impl/federated_read_session.cpp b/src/client/federated_topic/impl/federated_read_session.cpp index 30c85ac9d3e..90343c3d46f 100644 --- a/src/client/federated_topic/impl/federated_read_session.cpp +++ b/src/client/federated_topic/impl/federated_read_session.cpp @@ -11,7 +11,7 @@ #include #include -namespace NYdb::NFederatedTopic { +namespace NYdb::inline V3::NFederatedTopic { NTopic::TTopicClientSettings FromFederated(const TFederatedTopicClientSettings& settings); @@ -288,4 +288,4 @@ bool TFederatedReadSessionImpl::Close(TDuration timeout) { return result; } -} // namespace NYdb::NFederatedTopic +} // namespace NYdb::V3::NFederatedTopic diff --git a/src/client/federated_topic/impl/federated_read_session.h b/src/client/federated_topic/impl/federated_read_session.h index e01b58c7824..9b7d4cf9a61 100644 --- a/src/client/federated_topic/impl/federated_read_session.h +++ b/src/client/federated_topic/impl/federated_read_session.h @@ -7,7 +7,7 @@ #include -namespace NYdb::NFederatedTopic { +namespace NYdb::inline V3::NFederatedTopic { class TEventFederator { public: @@ -246,4 +246,4 @@ class TFederatedReadSession : public IFederatedReadSession, } }; -} // namespace NYdb::NFederatedTopic +} // namespace NYdb::V3::NFederatedTopic diff --git a/src/client/federated_topic/impl/federated_read_session_event.cpp b/src/client/federated_topic/impl/federated_read_session_event.cpp index 150345472c1..5c54f025701 100644 --- a/src/client/federated_topic/impl/federated_read_session_event.cpp +++ b/src/client/federated_topic/impl/federated_read_session_event.cpp @@ -4,7 +4,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Printable specializations -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { using namespace NFederatedTopic; @@ -135,7 +135,7 @@ void TPrintable::DebugString(TStringBuilder& ret, bool print } -namespace NYdb::NFederatedTopic { +namespace NYdb::inline V3::NFederatedTopic { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // NFederatedTopic::TReadSessionEvent::TDataReceivedEvent @@ -165,4 +165,4 @@ std::string DebugString(const TReadSessionEvent::TEvent& event) { return std::visit([](const auto& ev) { return ev.DebugString(); }, event); } -} // namespace NYdb::NFederatedTopic +} // namespace NYdb::V3::NFederatedTopic diff --git a/src/client/federated_topic/impl/federated_topic.cpp b/src/client/federated_topic/impl/federated_topic.cpp index e0f37d9d357..f74e05e3842 100644 --- a/src/client/federated_topic/impl/federated_topic.cpp +++ b/src/client/federated_topic/impl/federated_topic.cpp @@ -1,7 +1,7 @@ #include #include -namespace NYdb::NFederatedTopic { +namespace NYdb::inline V3::NFederatedTopic { // TFederatedReadSessionSettings // Read policy settings @@ -86,4 +86,4 @@ void TFederatedTopicClient::OverrideCodec(NTopic::ECodec codecId, std::unique_pt return Impl_->OverrideCodec(codecId, std::move(codecImpl)); } -} // namespace NYdb::NFederatedTopic +} // namespace NYdb::V3::NFederatedTopic diff --git a/src/client/federated_topic/impl/federated_topic_impl.cpp b/src/client/federated_topic/impl/federated_topic_impl.cpp index 4cf28a6212c..4a1384800e5 100644 --- a/src/client/federated_topic/impl/federated_topic_impl.cpp +++ b/src/client/federated_topic/impl/federated_topic_impl.cpp @@ -3,7 +3,7 @@ #include "federated_read_session.h" #include "federated_write_session.h" -namespace NYdb::NFederatedTopic { +namespace NYdb::inline V3::NFederatedTopic { std::shared_ptr TFederatedTopicClient::TImpl::CreateReadSession(const TFederatedReadSessionSettings& settings) { diff --git a/src/client/federated_topic/impl/federated_topic_impl.h b/src/client/federated_topic/impl/federated_topic_impl.h index 3c52904fbb3..73be8e544e2 100644 --- a/src/client/federated_topic/impl/federated_topic_impl.h +++ b/src/client/federated_topic/impl/federated_topic_impl.h @@ -12,7 +12,7 @@ #include #include -namespace NYdb::NFederatedTopic { +namespace NYdb::inline V3::NFederatedTopic { class TFederatedTopicClient::TImpl { public: @@ -89,4 +89,4 @@ class TFederatedTopicClient::TImpl { TAdaptiveLock Lock; }; -} // namespace NYdb::NFederatedTopic +} // namespace NYdb::V3::NFederatedTopic diff --git a/src/client/federated_topic/impl/federated_write_session.cpp b/src/client/federated_topic/impl/federated_write_session.cpp index cb4bbba85c7..5d6b312fc6b 100644 --- a/src/client/federated_topic/impl/federated_write_session.cpp +++ b/src/client/federated_topic/impl/federated_write_session.cpp @@ -11,7 +11,7 @@ #include -namespace NYdb::NFederatedTopic { +namespace NYdb::inline V3::NFederatedTopic { constexpr TDuration UPDATE_FEDERATION_STATE_DELAY = TDuration::Seconds(10); @@ -467,4 +467,4 @@ bool TFederatedWriteSessionImpl::Close(TDuration timeout) { } } -} // namespace NYdb::NFederatedTopic +} // namespace NYdb::V3::NFederatedTopic diff --git a/src/client/federated_topic/impl/federated_write_session.h b/src/client/federated_topic/impl/federated_write_session.h index 878503b6e8c..670558d69fb 100644 --- a/src/client/federated_topic/impl/federated_write_session.h +++ b/src/client/federated_topic/impl/federated_write_session.h @@ -6,7 +6,7 @@ #include -namespace NYdb::NFederatedTopic { +namespace NYdb::inline V3::NFederatedTopic { std::pair, EStatus> SelectDatabaseByHashImpl( NTopic::TFederatedWriteSessionSettings const& settings, @@ -206,4 +206,4 @@ class TFederatedWriteSession : public NTopic::IWriteSession, } }; -} // namespace NYdb::NFederatedTopic +} // namespace NYdb::V3::NFederatedTopic diff --git a/src/client/federated_topic/impl/federation_observer.cpp b/src/client/federated_topic/impl/federation_observer.cpp index a87d4863961..7d720c785a1 100644 --- a/src/client/federated_topic/impl/federation_observer.cpp +++ b/src/client/federated_topic/impl/federation_observer.cpp @@ -3,7 +3,7 @@ #include -namespace NYdb::NFederatedTopic { +namespace NYdb::inline V3::NFederatedTopic { constexpr TDuration REDISCOVERY_DELAY = TDuration::Seconds(30); @@ -200,4 +200,4 @@ IOutputStream& operator<<(IOutputStream& out, TFederatedDbState const& state) { return out << " }"; } -} // namespace NYdb::NFederatedTopic +} // namespace NYdb::V3::NFederatedTopic diff --git a/src/client/federated_topic/impl/federation_observer.h b/src/client/federated_topic/impl/federation_observer.h index e35c1d858d5..84e6cf16941 100644 --- a/src/client/federated_topic/impl/federation_observer.h +++ b/src/client/federated_topic/impl/federation_observer.h @@ -16,7 +16,7 @@ #include #include -namespace NYdb::NFederatedTopic { +namespace NYdb::inline V3::NFederatedTopic { struct TFederatedDbState { public: @@ -121,4 +121,4 @@ class TFederatedDbObserver : public NTopic::TContextOwner -namespace NYdb { +namespace NYdb::inline V3 { TDriverConfig CreateFromEnvironment(const std::string& connectionString) { TDriverConfig driverConfig; diff --git a/src/client/iam/common/iam.h b/src/client/iam/common/iam.h index 91ec93674e1..c7f7742c5a5 100644 --- a/src/client/iam/common/iam.h +++ b/src/client/iam/common/iam.h @@ -9,7 +9,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { constexpr TDuration BACKOFF_START = TDuration::MilliSeconds(50); constexpr TDuration BACKOFF_MAX = TDuration::Seconds(10); diff --git a/src/client/iam/iam.cpp b/src/client/iam/iam.cpp index 032de620a62..b3f7c59c873 100644 --- a/src/client/iam/iam.cpp +++ b/src/client/iam/iam.cpp @@ -10,7 +10,7 @@ using namespace yandex::cloud::iam::v1; -namespace NYdb { +namespace NYdb::inline V3 { class TIAMCredentialsProvider : public ICredentialsProvider { public: diff --git a/src/client/iam_private/iam.cpp b/src/client/iam_private/iam.cpp index 5a36b4cbc7f..294f8cc65df 100644 --- a/src/client/iam_private/iam.cpp +++ b/src/client/iam_private/iam.cpp @@ -5,7 +5,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { TCredentialsProviderFactoryPtr CreateIamJwtCredentialsProviderFactoryImplPrivate(TIamJwtParams&& jwtParams) { return std::make_shared #include -namespace NYdb { +namespace NYdb::inline V3 { using std::string; diff --git a/src/client/impl/ydb_endpoints/endpoints.h b/src/client/impl/ydb_endpoints/endpoints.h index b358d981583..ec6225311e6 100644 --- a/src/client/impl/ydb_endpoints/endpoints.h +++ b/src/client/impl/ydb_endpoints/endpoints.h @@ -7,7 +7,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { struct TEndpointRecord { std::string Endpoint; diff --git a/src/client/impl/ydb_internal/common/client_pid.cpp b/src/client/impl/ydb_internal/common/client_pid.cpp index 91f091d7ed7..ec82d6b613f 100644 --- a/src/client/impl/ydb_internal/common/client_pid.cpp +++ b/src/client/impl/ydb_internal/common/client_pid.cpp @@ -13,7 +13,7 @@ #include #endif -namespace NYdb { +namespace NYdb::inline V3 { namespace { ui32 GetProcessId() { diff --git a/src/client/impl/ydb_internal/common/client_pid.h b/src/client/impl/ydb_internal/common/client_pid.h index dcfae5e61c2..b8136e16c04 100644 --- a/src/client/impl/ydb_internal/common/client_pid.h +++ b/src/client/impl/ydb_internal/common/client_pid.h @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { std::string GetClientPIDHeaderValue(); diff --git a/src/client/impl/ydb_internal/common/getenv.cpp b/src/client/impl/ydb_internal/common/getenv.cpp index e752851abca..d6d136dbd73 100644 --- a/src/client/impl/ydb_internal/common/getenv.cpp +++ b/src/client/impl/ydb_internal/common/getenv.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { std::string GetStrFromEnv(const char* envVarName, const std::string& defaultValue) { auto envVarPointer = getenv(envVarName); diff --git a/src/client/impl/ydb_internal/common/getenv.h b/src/client/impl/ydb_internal/common/getenv.h index 8c9453b1297..b105bf5e948 100644 --- a/src/client/impl/ydb_internal/common/getenv.h +++ b/src/client/impl/ydb_internal/common/getenv.h @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { std::string GetStrFromEnv(const char* envVarName, const std::string& defaultValue = ""); diff --git a/src/client/impl/ydb_internal/common/parser.cpp b/src/client/impl/ydb_internal/common/parser.cpp index e4c3c2c20c2..879048743cb 100644 --- a/src/client/impl/ydb_internal/common/parser.cpp +++ b/src/client/impl/ydb_internal/common/parser.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { TConnectionInfo ParseConnectionString(const std::string& connectionString) { if (connectionString.length() == 0) { diff --git a/src/client/impl/ydb_internal/common/parser.h b/src/client/impl/ydb_internal/common/parser.h index 7c281cb21ee..13df795e6ae 100644 --- a/src/client/impl/ydb_internal/common/parser.h +++ b/src/client/impl/ydb_internal/common/parser.h @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { struct TConnectionInfo { std::string Endpoint = ""; diff --git a/src/client/impl/ydb_internal/common/types.h b/src/client/impl/ydb_internal/common/types.h index 4c18d46221f..7deb54f5118 100644 --- a/src/client/impl/ydb_internal/common/types.h +++ b/src/client/impl/ydb_internal/common/types.h @@ -10,7 +10,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { // Other callbacks using TSimpleCb = std::function; diff --git a/src/client/impl/ydb_internal/db_driver_state/authenticator.cpp b/src/client/impl/ydb_internal/db_driver_state/authenticator.cpp index 38160fba2e5..c0bfce96e0e 100644 --- a/src/client/impl/ydb_internal/db_driver_state/authenticator.cpp +++ b/src/client/impl/ydb_internal/db_driver_state/authenticator.cpp @@ -3,7 +3,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { TYdbAuthenticator::TYdbAuthenticator(std::shared_ptr credentialsProvider) : CredentialsProvider_(std::move(credentialsProvider)) diff --git a/src/client/impl/ydb_internal/db_driver_state/authenticator.h b/src/client/impl/ydb_internal/db_driver_state/authenticator.h index 92540939307..ff0ecb0fb26 100644 --- a/src/client/impl/ydb_internal/db_driver_state/authenticator.h +++ b/src/client/impl/ydb_internal/db_driver_state/authenticator.h @@ -6,7 +6,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { class TYdbAuthenticator : public grpc::MetadataCredentialsPlugin { public: diff --git a/src/client/impl/ydb_internal/db_driver_state/endpoint_pool.cpp b/src/client/impl/ydb_internal/db_driver_state/endpoint_pool.cpp index 49946489be2..50432a49bc3 100644 --- a/src/client/impl/ydb_internal/db_driver_state/endpoint_pool.cpp +++ b/src/client/impl/ydb_internal/db_driver_state/endpoint_pool.cpp @@ -1,7 +1,7 @@ #define INCLUDE_YDB_INTERNAL_H #include "endpoint_pool.h" -namespace NYdb { +namespace NYdb::inline V3 { using std::string; using std::vector; diff --git a/src/client/impl/ydb_internal/db_driver_state/endpoint_pool.h b/src/client/impl/ydb_internal/db_driver_state/endpoint_pool.h index 638105469d2..ac5e57993fb 100644 --- a/src/client/impl/ydb_internal/db_driver_state/endpoint_pool.h +++ b/src/client/impl/ydb_internal/db_driver_state/endpoint_pool.h @@ -11,7 +11,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { struct TListEndpointsResult { Ydb::Discovery::ListEndpointsResult Result; diff --git a/src/client/impl/ydb_internal/db_driver_state/state.cpp b/src/client/impl/ydb_internal/db_driver_state/state.cpp index 05affd18c0d..76f94af60c1 100644 --- a/src/client/impl/ydb_internal/db_driver_state/state.cpp +++ b/src/client/impl/ydb_internal/db_driver_state/state.cpp @@ -18,7 +18,7 @@ namespace { } } -namespace NYdb { +namespace NYdb::inline V3 { constexpr int PESSIMIZATION_DISCOVERY_THRESHOLD = 50; // percent of endpoints pessimized by transport error to start recheck constexpr TDuration ENDPOINT_UPDATE_PERIOD = TDuration::Minutes(1); // period to perform endpoints update in "normal" case diff --git a/src/client/impl/ydb_internal/db_driver_state/state.h b/src/client/impl/ydb_internal/db_driver_state/state.h index bf81784dd2c..ad2ff25b8f1 100644 --- a/src/client/impl/ydb_internal/db_driver_state/state.h +++ b/src/client/impl/ydb_internal/db_driver_state/state.h @@ -8,7 +8,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { class ICredentialsProvider; class ICredentialsProviderFactory; diff --git a/src/client/impl/ydb_internal/driver/constants.h b/src/client/impl/ydb_internal/driver/constants.h index 19d2246ac20..3b51aa92c0b 100644 --- a/src/client/impl/ydb_internal/driver/constants.h +++ b/src/client/impl/ydb_internal/driver/constants.h @@ -4,7 +4,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { constexpr uint64_t TCP_KEEPALIVE_IDLE = 30; // The time the connection needs to remain idle // before TCP starts sending keepalive probes, seconds diff --git a/src/client/impl/ydb_internal/grpc_connections/actions.cpp b/src/client/impl/ydb_internal/grpc_connections/actions.cpp index 0be7ef9fa95..196f40d38f7 100644 --- a/src/client/impl/ydb_internal/grpc_connections/actions.cpp +++ b/src/client/impl/ydb_internal/grpc_connections/actions.cpp @@ -4,7 +4,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { constexpr TDuration MAX_DEFERRED_CALL_DELAY = TDuration::Seconds(10); // The max delay between GetOperation calls for one operation diff --git a/src/client/impl/ydb_internal/grpc_connections/actions.h b/src/client/impl/ydb_internal/grpc_connections/actions.h index 20150d7c25e..b95f78ce623 100644 --- a/src/client/impl/ydb_internal/grpc_connections/actions.h +++ b/src/client/impl/ydb_internal/grpc_connections/actions.h @@ -13,7 +13,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { using NYdbGrpc::IQueueClientContext; using NYdbGrpc::IQueueClientEvent; diff --git a/src/client/impl/ydb_internal/grpc_connections/grpc_connections.cpp b/src/client/impl/ydb_internal/grpc_connections/grpc_connections.cpp index 3ecf2d3fb43..a3eba4dc8a0 100644 --- a/src/client/impl/ydb_internal/grpc_connections/grpc_connections.cpp +++ b/src/client/impl/ydb_internal/grpc_connections/grpc_connections.cpp @@ -3,7 +3,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { bool IsTokenCorrect(const std::string& in) { for (char c : in) { diff --git a/src/client/impl/ydb_internal/grpc_connections/grpc_connections.h b/src/client/impl/ydb_internal/grpc_connections/grpc_connections.h index 30ba3e1d655..3eeb79af21a 100644 --- a/src/client/impl/ydb_internal/grpc_connections/grpc_connections.h +++ b/src/client/impl/ydb_internal/grpc_connections/grpc_connections.h @@ -16,7 +16,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { constexpr TDuration GRPC_KEEP_ALIVE_TIMEOUT_FOR_DISCOVERY = TDuration::Seconds(10); constexpr TDuration INITIAL_DEFERRED_CALL_DELAY = TDuration::MilliSeconds(10); // The delay before first deferred service call diff --git a/src/client/impl/ydb_internal/grpc_connections/params.h b/src/client/impl/ydb_internal/grpc_connections/params.h index 5672ec2bf4d..b0670a8e484 100644 --- a/src/client/impl/ydb_internal/grpc_connections/params.h +++ b/src/client/impl/ydb_internal/grpc_connections/params.h @@ -7,7 +7,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { class IConnectionsParams { public: diff --git a/src/client/impl/ydb_internal/internal_client/client.h b/src/client/impl/ydb_internal/internal_client/client.h index ff5327bd3a5..b40003b5077 100644 --- a/src/client/impl/ydb_internal/internal_client/client.h +++ b/src/client/impl/ydb_internal/internal_client/client.h @@ -14,7 +14,7 @@ namespace NMonitoring { class TMetricRegistry; } -namespace NYdb { +namespace NYdb::inline V3 { class TDbDriverState; struct TListEndpointsResult; diff --git a/src/client/impl/ydb_internal/kqp_session_common/kqp_session_common.cpp b/src/client/impl/ydb_internal/kqp_session_common/kqp_session_common.cpp index 8353f4c0b6a..299f3f02455 100644 --- a/src/client/impl/ydb_internal/kqp_session_common/kqp_session_common.cpp +++ b/src/client/impl/ydb_internal/kqp_session_common/kqp_session_common.cpp @@ -3,7 +3,8 @@ #include #include -namespace NYdb { + +namespace NYdb::inline V3 { using std::string; diff --git a/src/client/impl/ydb_internal/kqp_session_common/kqp_session_common.h b/src/client/impl/ydb_internal/kqp_session_common/kqp_session_common.h index daa13caefe6..6256c23e7e8 100644 --- a/src/client/impl/ydb_internal/kqp_session_common/kqp_session_common.h +++ b/src/client/impl/ydb_internal/kqp_session_common/kqp_session_common.h @@ -8,7 +8,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { //////////////////////////////////////////////////////////////////////////////// ui64 GetNodeIdFromSession(const std::string& sessionId); diff --git a/src/client/impl/ydb_internal/logger/log.cpp b/src/client/impl/ydb_internal/logger/log.cpp index 1b9ae0c7bf9..f8a8dcbcaf0 100644 --- a/src/client/impl/ydb_internal/logger/log.cpp +++ b/src/client/impl/ydb_internal/logger/log.cpp @@ -6,7 +6,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { static const std::string_view LogPrioritiesStrings[] = { " :EMERG: ", diff --git a/src/client/impl/ydb_internal/logger/log.h b/src/client/impl/ydb_internal/logger/log.h index ace543504ed..1a4c6e19f43 100644 --- a/src/client/impl/ydb_internal/logger/log.h +++ b/src/client/impl/ydb_internal/logger/log.h @@ -4,7 +4,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { TLogFormatter GetPrefixLogFormatter(const std::string& prefix); std::string GetDatabaseLogPrefix(const std::string& database); diff --git a/src/client/impl/ydb_internal/make_request/make.cpp b/src/client/impl/ydb_internal/make_request/make.cpp index bfbf465529a..e16b9ae8d43 100644 --- a/src/client/impl/ydb_internal/make_request/make.cpp +++ b/src/client/impl/ydb_internal/make_request/make.cpp @@ -2,7 +2,7 @@ #include "make.h" -namespace NYdb { +namespace NYdb::inline V3 { void SetDuration(const TDuration& duration, google::protobuf::Duration& protoValue) { protoValue.set_seconds(duration.Seconds()); diff --git a/src/client/impl/ydb_internal/make_request/make.h b/src/client/impl/ydb_internal/make_request/make.h index ab11ef77d05..9f7a29a30a5 100644 --- a/src/client/impl/ydb_internal/make_request/make.h +++ b/src/client/impl/ydb_internal/make_request/make.h @@ -7,7 +7,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { void SetDuration(const TDuration& duration, google::protobuf::Duration& protoValue); diff --git a/src/client/impl/ydb_internal/plain_status/status.cpp b/src/client/impl/ydb_internal/plain_status/status.cpp index 757321b27c5..bb29e6583e9 100644 --- a/src/client/impl/ydb_internal/plain_status/status.cpp +++ b/src/client/impl/ydb_internal/plain_status/status.cpp @@ -3,7 +3,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { using std::string; diff --git a/src/client/impl/ydb_internal/plain_status/status.h b/src/client/impl/ydb_internal/plain_status/status.h index d0109d38e64..b8a2ca71e1d 100644 --- a/src/client/impl/ydb_internal/plain_status/status.h +++ b/src/client/impl/ydb_internal/plain_status/status.h @@ -11,7 +11,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { struct TPlainStatus { EStatus Status; diff --git a/src/client/impl/ydb_internal/retry/retry.cpp b/src/client/impl/ydb_internal/retry/retry.cpp index 7f4315e1c18..dbeb516677d 100644 --- a/src/client/impl/ydb_internal/retry/retry.cpp +++ b/src/client/impl/ydb_internal/retry/retry.cpp @@ -9,7 +9,7 @@ #include -namespace NYdb::NRetry { +namespace NYdb::inline V3::NRetry { constexpr ui32 MAX_BACKOFF_DURATION_MS = TDuration::Hours(1).MilliSeconds(); diff --git a/src/client/impl/ydb_internal/retry/retry.h b/src/client/impl/ydb_internal/retry/retry.h index 738f7efc4ec..d8f5f8bb792 100644 --- a/src/client/impl/ydb_internal/retry/retry.h +++ b/src/client/impl/ydb_internal/retry/retry.h @@ -13,11 +13,11 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { class IClientImplCommon; } -namespace NYdb::NRetry { +namespace NYdb::inline V3::NRetry { ui32 CalcBackoffTime(const TBackoffSettings& settings, ui32 retryNumber); void Backoff(const NRetry::TBackoffSettings& settings, ui32 retryNumber); diff --git a/src/client/impl/ydb_internal/retry/retry_async.h b/src/client/impl/ydb_internal/retry/retry_async.h index 393b9d9d0a6..f19a0bf3371 100644 --- a/src/client/impl/ydb_internal/retry/retry_async.h +++ b/src/client/impl/ydb_internal/retry/retry_async.h @@ -4,7 +4,7 @@ #include -namespace NYdb::NRetry::Async { +namespace NYdb::inline V3::NRetry::Async { template class TRetryContext : public TThrRefBase, public TRetryContextBase { diff --git a/src/client/impl/ydb_internal/retry/retry_sync.h b/src/client/impl/ydb_internal/retry/retry_sync.h index d9ac41295ea..b0c63187bdd 100644 --- a/src/client/impl/ydb_internal/retry/retry_sync.h +++ b/src/client/impl/ydb_internal/retry/retry_sync.h @@ -4,7 +4,7 @@ #include #include -namespace NYdb::NRetry::Sync { +namespace NYdb::inline V3::NRetry::Sync { template class TRetryContext : public TRetryContextBase { diff --git a/src/client/impl/ydb_internal/rpc_request_settings/settings.h b/src/client/impl/ydb_internal/rpc_request_settings/settings.h index 34a31f115ee..515d20f6422 100644 --- a/src/client/impl/ydb_internal/rpc_request_settings/settings.h +++ b/src/client/impl/ydb_internal/rpc_request_settings/settings.h @@ -3,7 +3,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { struct TRpcRequestSettings { std::string TraceId; diff --git a/src/client/impl/ydb_internal/scheme_helpers/helpers.h b/src/client/impl/ydb_internal/scheme_helpers/helpers.h index 9a6998b1cca..5a4c8528b19 100644 --- a/src/client/impl/ydb_internal/scheme_helpers/helpers.h +++ b/src/client/impl/ydb_internal/scheme_helpers/helpers.h @@ -3,7 +3,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { template inline void PermissionToSchemeEntry(const TFrom& from, std::vector* to) { diff --git a/src/client/impl/ydb_internal/session_client/session_client.h b/src/client/impl/ydb_internal/session_client/session_client.h index 49f26b28d0e..db920a7ab90 100644 --- a/src/client/impl/ydb_internal/session_client/session_client.h +++ b/src/client/impl/ydb_internal/session_client/session_client.h @@ -4,7 +4,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { class TKqpSessionCommon; diff --git a/src/client/impl/ydb_internal/session_pool/session_pool.cpp b/src/client/impl/ydb_internal/session_pool/session_pool.cpp index 77025f8a3cd..9484becb530 100644 --- a/src/client/impl/ydb_internal/session_pool/session_pool.cpp +++ b/src/client/impl/ydb_internal/session_pool/session_pool.cpp @@ -9,7 +9,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NSessionPool { using namespace NThreading; diff --git a/src/client/impl/ydb_internal/session_pool/session_pool.h b/src/client/impl/ydb_internal/session_pool/session_pool.h index 18a526ba1e3..4a317b9704c 100644 --- a/src/client/impl/ydb_internal/session_pool/session_pool.h +++ b/src/client/impl/ydb_internal/session_pool/session_pool.h @@ -4,7 +4,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { class TOperation; namespace NSessionPool { diff --git a/src/client/impl/ydb_internal/stats_extractor/extractor.h b/src/client/impl/ydb_internal/stats_extractor/extractor.h index a729dde937f..964f30fea0b 100644 --- a/src/client/impl/ydb_internal/stats_extractor/extractor.h +++ b/src/client/impl/ydb_internal/stats_extractor/extractor.h @@ -8,7 +8,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { class TStatsExtractor: public NSdkStats::IStatApi { public: diff --git a/src/client/impl/ydb_internal/table_helpers/helpers.h b/src/client/impl/ydb_internal/table_helpers/helpers.h index 2749a59dd3a..80e1ce47aea 100644 --- a/src/client/impl/ydb_internal/table_helpers/helpers.h +++ b/src/client/impl/ydb_internal/table_helpers/helpers.h @@ -5,7 +5,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { inline Ydb::Table::QueryStatsCollection::Mode GetStatsCollectionMode(std::optional mode) { if (mode.has_value()) { diff --git a/src/client/impl/ydb_internal/thread_pool/pool.h b/src/client/impl/ydb_internal/thread_pool/pool.h index 3c1c07ba644..f29a7bb6238 100644 --- a/src/client/impl/ydb_internal/thread_pool/pool.h +++ b/src/client/impl/ydb_internal/thread_pool/pool.h @@ -6,7 +6,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { inline std::unique_ptr CreateThreadPool(size_t threads) { std::unique_ptr queue; diff --git a/src/client/impl/ydb_internal/value_helpers/helpers.cpp b/src/client/impl/ydb_internal/value_helpers/helpers.cpp index dc8eaef59b7..ebfbe83c832 100644 --- a/src/client/impl/ydb_internal/value_helpers/helpers.cpp +++ b/src/client/impl/ydb_internal/value_helpers/helpers.cpp @@ -4,7 +4,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { bool TypesEqual(const Ydb::Type& t1, const Ydb::Type& t2) { if (t1.type_case() != t2.type_case()) { diff --git a/src/client/impl/ydb_internal/value_helpers/helpers.h b/src/client/impl/ydb_internal/value_helpers/helpers.h index 54cc366e1b4..8bb70e0ea9d 100644 --- a/src/client/impl/ydb_internal/value_helpers/helpers.h +++ b/src/client/impl/ydb_internal/value_helpers/helpers.h @@ -4,7 +4,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { bool TypesEqual(const Ydb::Type& t1, const Ydb::Type& t2); diff --git a/src/client/impl/ydb_stats/stats.cpp b/src/client/impl/ydb_stats/stats.cpp index 916ce1239f2..4139ba9dd93 100644 --- a/src/client/impl/ydb_stats/stats.cpp +++ b/src/client/impl/ydb_stats/stats.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NSdkStats { using std::string; diff --git a/src/client/impl/ydb_stats/stats.h b/src/client/impl/ydb_stats/stats.h index a4c7a610cfd..9226872c9a7 100644 --- a/src/client/impl/ydb_stats/stats.h +++ b/src/client/impl/ydb_stats/stats.h @@ -9,8 +9,7 @@ #include #include -namespace NYdb { - +namespace NYdb::inline V3 { namespace NSdkStats { // works only for case normal (foo_bar) underscore @@ -401,5 +400,4 @@ struct TStatCollector { }; } // namespace NSdkStats - -} // namespace Nydb +} // namespace NYdb diff --git a/src/client/import/import.cpp b/src/client/import/import.cpp index 6eaa52b16d6..fe8062a3c7d 100644 --- a/src/client/import/import.cpp +++ b/src/client/import/import.cpp @@ -10,7 +10,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NImport { using namespace NThreading; diff --git a/src/client/monitoring/monitoring.cpp b/src/client/monitoring/monitoring.cpp index 8650dd22cef..6b7b4f1bcf1 100644 --- a/src/client/monitoring/monitoring.cpp +++ b/src/client/monitoring/monitoring.cpp @@ -9,7 +9,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NMonitoring { using namespace NThreading; diff --git a/src/client/operation/operation.cpp b/src/client/operation/operation.cpp index 0c815473fe1..059fa9d2d80 100644 --- a/src/client/operation/operation.cpp +++ b/src/client/operation/operation.cpp @@ -15,7 +15,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NOperation { constexpr TDuration OPERATION_CLIENT_TIMEOUT = TDuration::Seconds(5); diff --git a/src/client/params/impl.cpp b/src/client/params/impl.cpp index 63c91ef60b0..62f231eefc9 100644 --- a/src/client/params/impl.cpp +++ b/src/client/params/impl.cpp @@ -4,7 +4,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { TParams::TImpl::TImpl(::google::protobuf::Map&& paramsMap) { ParamsMap_.swap(paramsMap); diff --git a/src/client/params/impl.h b/src/client/params/impl.h index 6e4506c4e4e..8594f955f74 100644 --- a/src/client/params/impl.h +++ b/src/client/params/impl.h @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { class TParams::TImpl { public: diff --git a/src/client/params/params.cpp b/src/client/params/params.cpp index c15b144bca7..5d448a2d756 100644 --- a/src/client/params/params.cpp +++ b/src/client/params/params.cpp @@ -8,7 +8,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { //////////////////////////////////////////////////////////////////////////////// diff --git a/src/client/persqueue_public/impl/aliases.h b/src/client/persqueue_public/impl/aliases.h index 2796da017ad..96de4ce1c8c 100644 --- a/src/client/persqueue_public/impl/aliases.h +++ b/src/client/persqueue_public/impl/aliases.h @@ -5,7 +5,7 @@ #include #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { // codecs using NTopic::ICodec; diff --git a/src/client/persqueue_public/impl/common.cpp b/src/client/persqueue_public/impl/common.cpp index aa806f415fa..18df160d2e9 100644 --- a/src/client/persqueue_public/impl/common.cpp +++ b/src/client/persqueue_public/impl/common.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { ERetryErrorClass GetRetryErrorClass(EStatus status) { switch (status) { diff --git a/src/client/persqueue_public/impl/common.h b/src/client/persqueue_public/impl/common.h index 945b411e734..b99341fbbb4 100644 --- a/src/client/persqueue_public/impl/common.h +++ b/src/client/persqueue_public/impl/common.h @@ -4,7 +4,7 @@ #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { ERetryErrorClass GetRetryErrorClass(EStatus status); ERetryErrorClass GetRetryErrorClassV2(EStatus status); } diff --git a/src/client/persqueue_public/impl/persqueue.cpp b/src/client/persqueue_public/impl/persqueue.cpp index 82f5c7332fc..4fad6d95f63 100644 --- a/src/client/persqueue_public/impl/persqueue.cpp +++ b/src/client/persqueue_public/impl/persqueue.cpp @@ -8,7 +8,7 @@ #include #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { class TCommonCodecsProvider { public: diff --git a/src/client/persqueue_public/impl/persqueue_impl.cpp b/src/client/persqueue_public/impl/persqueue_impl.cpp index 29435231b17..0ce4ff9efa4 100644 --- a/src/client/persqueue_public/impl/persqueue_impl.cpp +++ b/src/client/persqueue_public/impl/persqueue_impl.cpp @@ -3,7 +3,7 @@ #include "read_session.h" #include "write_session.h" -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { std::shared_ptr TPersQueueClient::TImpl::CreateReadSession(const TReadSessionSettings& settings) { std::optional maybeSettings; diff --git a/src/client/persqueue_public/impl/persqueue_impl.h b/src/client/persqueue_public/impl/persqueue_impl.h index 0f90c4f9617..31d38e2956d 100644 --- a/src/client/persqueue_public/impl/persqueue_impl.h +++ b/src/client/persqueue_public/impl/persqueue_impl.h @@ -12,7 +12,7 @@ #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { class TPersQueueClient::TImpl : public TClientImplCommon { public: diff --git a/src/client/persqueue_public/impl/read_session.cpp b/src/client/persqueue_public/impl/read_session.cpp index 45bda6e817e..3e0e9dda3a9 100644 --- a/src/client/persqueue_public/impl/read_session.cpp +++ b/src/client/persqueue_public/impl/read_session.cpp @@ -10,7 +10,7 @@ #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { static const std::string DRIVER_IS_STOPPING_DESCRIPTION = "Driver is stopping"; diff --git a/src/client/persqueue_public/impl/read_session.h b/src/client/persqueue_public/impl/read_session.h index 1903995f76b..df67c60d214 100644 --- a/src/client/persqueue_public/impl/read_session.h +++ b/src/client/persqueue_public/impl/read_session.h @@ -8,7 +8,7 @@ #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { // High level class that manages several read session impls. // Each one of them works with single cluster. diff --git a/src/client/persqueue_public/impl/read_session_messages.cpp b/src/client/persqueue_public/impl/read_session_messages.cpp index 2eb44e96330..4d7a82631d4 100644 --- a/src/client/persqueue_public/impl/read_session_messages.cpp +++ b/src/client/persqueue_public/impl/read_session_messages.cpp @@ -4,7 +4,7 @@ #include #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { TReadSessionEvent::TDataReceivedEvent::TMessageInformation::TMessageInformation( ui64 offset, diff --git a/src/client/persqueue_public/impl/write_session.cpp b/src/client/persqueue_public/impl/write_session.cpp index 52df1286f4e..efafbfa2d5d 100644 --- a/src/client/persqueue_public/impl/write_session.cpp +++ b/src/client/persqueue_public/impl/write_session.cpp @@ -8,7 +8,7 @@ #include #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // TWriteSession diff --git a/src/client/persqueue_public/impl/write_session.h b/src/client/persqueue_public/impl/write_session.h index 41873ceb7d2..7fa9f4c2c61 100644 --- a/src/client/persqueue_public/impl/write_session.h +++ b/src/client/persqueue_public/impl/write_session.h @@ -8,7 +8,7 @@ #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { namespace NTests { class TSimpleWriteSessionTestAdapter; diff --git a/src/client/persqueue_public/impl/write_session_impl.cpp b/src/client/persqueue_public/impl/write_session_impl.cpp index 4b9dd0eec00..022bea0714e 100644 --- a/src/client/persqueue_public/impl/write_session_impl.cpp +++ b/src/client/persqueue_public/impl/write_session_impl.cpp @@ -11,7 +11,7 @@ #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { const TDuration UPDATE_TOKEN_PERIOD = TDuration::Hours(1); diff --git a/src/client/persqueue_public/impl/write_session_impl.h b/src/client/persqueue_public/impl/write_session_impl.h index 82a8bbdb7ac..483570c944c 100644 --- a/src/client/persqueue_public/impl/write_session_impl.h +++ b/src/client/persqueue_public/impl/write_session_impl.h @@ -7,7 +7,7 @@ #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // TWriteSessionEventsQueue diff --git a/src/client/persqueue_public/include/aliases.h b/src/client/persqueue_public/include/aliases.h index 24f0ffa5a97..0cd8c0c8354 100644 --- a/src/client/persqueue_public/include/aliases.h +++ b/src/client/persqueue_public/include/aliases.h @@ -7,7 +7,7 @@ #include #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { // codecs using NTopic::ECodec; diff --git a/src/client/persqueue_public/include/client.h b/src/client/persqueue_public/include/client.h index 1797fda685f..71bfd09507d 100644 --- a/src/client/persqueue_public/include/client.h +++ b/src/client/persqueue_public/include/client.h @@ -7,11 +7,11 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { class TProtoAccessor; } -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { struct TPersQueueClientSettings : public TCommonClientSettingsBase { using TSelf = TPersQueueClientSettings; diff --git a/src/client/persqueue_public/include/control_plane.h b/src/client/persqueue_public/include/control_plane.h index 0511fb8e507..025364aecce 100644 --- a/src/client/persqueue_public/include/control_plane.h +++ b/src/client/persqueue_public/include/control_plane.h @@ -10,11 +10,11 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { class TProtoAccessor; } -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { enum class EFormat { BASE = 1, @@ -45,7 +45,7 @@ struct TCredentials { // Result for describe resource request. struct TDescribeTopicResult : public TStatus { - friend class NYdb::TProtoAccessor; + friend class NYdb::V3::TProtoAccessor; struct TTopicSettings { TTopicSettings(const Ydb::PersQueue::V1::TopicSettings&); diff --git a/src/client/persqueue_public/include/read_events.h b/src/client/persqueue_public/include/read_events.h index 494bad2fd6c..7152be32513 100644 --- a/src/client/persqueue_public/include/read_events.h +++ b/src/client/persqueue_public/include/read_events.h @@ -4,7 +4,7 @@ #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { //! Partition stream. struct TPartitionStream : public TThrRefBase { diff --git a/src/client/persqueue_public/include/read_session.h b/src/client/persqueue_public/include/read_session.h index 1c33c8d9d54..9d80184840f 100644 --- a/src/client/persqueue_public/include/read_session.h +++ b/src/client/persqueue_public/include/read_session.h @@ -11,7 +11,7 @@ #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { //! Read settings for single topic. struct TTopicReadSettings { diff --git a/src/client/persqueue_public/include/write_events.h b/src/client/persqueue_public/include/write_events.h index 3bcd61f058a..2f5cee513e9 100644 --- a/src/client/persqueue_public/include/write_events.h +++ b/src/client/persqueue_public/include/write_events.h @@ -6,7 +6,7 @@ #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { struct TWriteStat : public TThrRefBase { TDuration WriteTime; diff --git a/src/client/persqueue_public/include/write_session.h b/src/client/persqueue_public/include/write_session.h index c2cbc776d74..98852c46488 100644 --- a/src/client/persqueue_public/include/write_session.h +++ b/src/client/persqueue_public/include/write_session.h @@ -8,7 +8,7 @@ #include -namespace NYdb::NPersQueue { +namespace NYdb::inline V3::NPersQueue { enum class EClusterDiscoveryMode { Auto = 0, // enables cluster discovery only for hostname "logbroker.yandex.net" and "logbroker-prestable.yandex.net" diff --git a/src/client/proto/accessor.cpp b/src/client/proto/accessor.cpp index 7ec24b47155..9adbba5c0e6 100644 --- a/src/client/proto/accessor.cpp +++ b/src/client/proto/accessor.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { const Ydb::Type& TProtoAccessor::GetProto(const TType& type) { return type.GetProto(); diff --git a/src/client/query/client.cpp b/src/client/query/client.cpp index bf9ccb90fec..44ee0cdcb59 100644 --- a/src/client/query/client.cpp +++ b/src/client/query/client.cpp @@ -19,7 +19,7 @@ #include -namespace NYdb::NQuery { +namespace NYdb::inline V3::NQuery { using TRetryContextResultAsync = NRetry::Async::TRetryContext; using TRetryContextAsync = NRetry::Async::TRetryContext; diff --git a/src/client/query/impl/client_session.cpp b/src/client/query/impl/client_session.cpp index 40b5ab7c97c..eb8281f1dcd 100644 --- a/src/client/query/impl/client_session.cpp +++ b/src/client/query/impl/client_session.cpp @@ -6,7 +6,7 @@ #include -namespace NYdb::NQuery { +namespace NYdb::inline V3::NQuery { TSession::TImpl::TImpl(TStreamProcessorPtr ptr, const std::string& sessionId, const std::string& endpoint) : TKqpSessionCommon(sessionId, endpoint, true) diff --git a/src/client/query/impl/client_session.h b/src/client/query/impl/client_session.h index 4400c30d3b3..2a9b8ac52cf 100644 --- a/src/client/query/impl/client_session.h +++ b/src/client/query/impl/client_session.h @@ -5,7 +5,7 @@ #include -namespace NYdb::NQuery { +namespace NYdb::inline V3::NQuery { class TSession::TImpl : public TKqpSessionCommon { public: diff --git a/src/client/query/impl/exec_query.cpp b/src/client/query/impl/exec_query.cpp index 6e8541a927c..a26daebabca 100644 --- a/src/client/query/impl/exec_query.cpp +++ b/src/client/query/impl/exec_query.cpp @@ -13,7 +13,7 @@ #include -namespace NYdb::NQuery { +namespace NYdb::inline V3::NQuery { using namespace NThreading; diff --git a/src/client/query/impl/exec_query.h b/src/client/query/impl/exec_query.h index 33caee5b0b1..b20246e84be 100644 --- a/src/client/query/impl/exec_query.h +++ b/src/client/query/impl/exec_query.h @@ -7,7 +7,7 @@ #include #include -namespace NYdb::NQuery { +namespace NYdb::inline V3::NQuery { class TExecQueryImpl { public: diff --git a/src/client/query/query.cpp b/src/client/query/query.cpp index 971d33014c0..5934edef92c 100644 --- a/src/client/query/query.cpp +++ b/src/client/query/query.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb::NQuery { +namespace NYdb::inline V3::NQuery { std::optional ParseStatsMode(std::string_view statsMode) { if (statsMode == "unspecified") { diff --git a/src/client/query/stats.cpp b/src/client/query/stats.cpp index 5764c39e3a1..02da828dfad 100644 --- a/src/client/query/stats.cpp +++ b/src/client/query/stats.cpp @@ -8,7 +8,7 @@ #include -namespace NYdb::NQuery { +namespace NYdb::inline V3::NQuery { class TExecStats::TImpl { public: diff --git a/src/client/rate_limiter/rate_limiter.cpp b/src/client/rate_limiter/rate_limiter.cpp index d790a4cf567..05f8cca2496 100644 --- a/src/client/rate_limiter/rate_limiter.cpp +++ b/src/client/rate_limiter/rate_limiter.cpp @@ -7,7 +7,7 @@ #include #include -namespace NYdb::NRateLimiter { +namespace NYdb::inline V3::NRateLimiter { TListResourcesResult::TListResourcesResult(TStatus status, std::vector paths) : TStatus(std::move(status)) diff --git a/src/client/resources/ydb_ca.cpp b/src/client/resources/ydb_ca.cpp index 21a538623d7..6c33ac213f3 100644 --- a/src/client/resources/ydb_ca.cpp +++ b/src/client/resources/ydb_ca.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { std::string GetRootCertificate() { return NResource::Find("ydb_root_ca.pem"); diff --git a/src/client/resources/ydb_resources.cpp b/src/client/resources/ydb_resources.cpp index 580d308044d..daf614fb331 100644 --- a/src/client/resources/ydb_resources.cpp +++ b/src/client/resources/ydb_resources.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { const char* YDB_AUTH_TICKET_HEADER = "x-ydb-auth-ticket"; const char* YDB_DATABASE_HEADER = "x-ydb-database"; diff --git a/src/client/resources/ydb_sdk_version.txt b/src/client/resources/ydb_sdk_version.txt index d5724cd41b6..56fea8a08d2 100644 --- a/src/client/resources/ydb_sdk_version.txt +++ b/src/client/resources/ydb_sdk_version.txt @@ -1 +1 @@ -2.6.2 \ No newline at end of file +3.0.0 \ No newline at end of file diff --git a/src/client/result/proto_accessor.cpp b/src/client/result/proto_accessor.cpp index 9e20cb2af30..3e5e35018ef 100644 --- a/src/client/result/proto_accessor.cpp +++ b/src/client/result/proto_accessor.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { const Ydb::ResultSet& TProtoAccessor::GetProto(const TResultSet& resultSet) { return resultSet.GetProto(); diff --git a/src/client/result/result.cpp b/src/client/result/result.cpp index 4f52c549325..97fd03c70d4 100644 --- a/src/client/result/result.cpp +++ b/src/client/result/result.cpp @@ -11,7 +11,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { std::string TColumn::ToString() const { TString result; diff --git a/src/client/scheme/scheme.cpp b/src/client/scheme/scheme.cpp index 08d9fb5e0e0..0eb5d1d95ef 100644 --- a/src/client/scheme/scheme.cpp +++ b/src/client/scheme/scheme.cpp @@ -11,7 +11,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NScheme { using namespace NThreading; diff --git a/src/client/ss_tasks/task.cpp b/src/client/ss_tasks/task.cpp index 39216d228ef..cee6cc3e53c 100644 --- a/src/client/ss_tasks/task.cpp +++ b/src/client/ss_tasks/task.cpp @@ -5,7 +5,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NSchemeShard { /// YT diff --git a/src/client/ss_tasks/task.h b/src/client/ss_tasks/task.h index 1f51f806cb7..5c0c4db1868 100644 --- a/src/client/ss_tasks/task.h +++ b/src/client/ss_tasks/task.h @@ -5,7 +5,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NSchemeShard { class TBackgroundProcessesResponse: public TOperation { diff --git a/src/client/table/impl/client_session.cpp b/src/client/table/impl/client_session.cpp index 4e5ccc42b90..cbab337644c 100644 --- a/src/client/table/impl/client_session.cpp +++ b/src/client/table/impl/client_session.cpp @@ -3,7 +3,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NTable { TSession::TImpl::TImpl(const std::string& sessionId, const std::string& endpoint, bool useQueryCache, ui32 queryCacheSize, bool isOwnedBySessionPool) diff --git a/src/client/table/impl/client_session.h b/src/client/table/impl/client_session.h index 4e4a9aeb933..dab53f500fa 100644 --- a/src/client/table/impl/client_session.h +++ b/src/client/table/impl/client_session.h @@ -13,7 +13,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NTable { //////////////////////////////////////////////////////////////////////////////// diff --git a/src/client/table/impl/data_query.cpp b/src/client/table/impl/data_query.cpp index 7d9f87247ca..2afe7bd6369 100644 --- a/src/client/table/impl/data_query.cpp +++ b/src/client/table/impl/data_query.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NTable { std::string GetQueryHash(const std::string& text) { diff --git a/src/client/table/impl/data_query.h b/src/client/table/impl/data_query.h index 2c2ec5b9237..a04fcebc27e 100644 --- a/src/client/table/impl/data_query.h +++ b/src/client/table/impl/data_query.h @@ -7,7 +7,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NTable { std::string EncodeQuery(const std::string& text, bool reversible); diff --git a/src/client/table/impl/readers.cpp b/src/client/table/impl/readers.cpp index 505e1f2cb0c..acb5f6dd58b 100644 --- a/src/client/table/impl/readers.cpp +++ b/src/client/table/impl/readers.cpp @@ -3,7 +3,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NTable { using namespace NThreading; diff --git a/src/client/table/impl/readers.h b/src/client/table/impl/readers.h index cba8c674b1e..440c9b8de01 100644 --- a/src/client/table/impl/readers.h +++ b/src/client/table/impl/readers.h @@ -12,7 +12,7 @@ #include "request_migrator.h" -namespace NYdb { +namespace NYdb::inline V3 { namespace NTable { using namespace NThreading; diff --git a/src/client/table/impl/request_migrator.cpp b/src/client/table/impl/request_migrator.cpp index 21fe00039b4..94d49735817 100644 --- a/src/client/table/impl/request_migrator.cpp +++ b/src/client/table/impl/request_migrator.cpp @@ -4,7 +4,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NMath { diff --git a/src/client/table/impl/request_migrator.h b/src/client/table/impl/request_migrator.h index 8b0dbb9f187..e33967d42b6 100644 --- a/src/client/table/impl/request_migrator.h +++ b/src/client/table/impl/request_migrator.h @@ -11,7 +11,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NMath { diff --git a/src/client/table/impl/table_client.cpp b/src/client/table/impl/table_client.cpp index 06940d5a61f..335c46d555b 100644 --- a/src/client/table/impl/table_client.cpp +++ b/src/client/table/impl/table_client.cpp @@ -1,6 +1,6 @@ #include "table_client.h" -namespace NYdb { +namespace NYdb::inline V3 { namespace NTable { diff --git a/src/client/table/impl/table_client.h b/src/client/table/impl/table_client.h index dbb94fa2096..03c78f282bf 100644 --- a/src/client/table/impl/table_client.h +++ b/src/client/table/impl/table_client.h @@ -19,7 +19,7 @@ #include "readers.h" -namespace NYdb { +namespace NYdb::inline V3 { namespace NTable { //How ofter run host scan to perform session balancing diff --git a/src/client/table/impl/transaction.cpp b/src/client/table/impl/transaction.cpp index 8234ae26b13..6627804a186 100644 --- a/src/client/table/impl/transaction.cpp +++ b/src/client/table/impl/transaction.cpp @@ -1,7 +1,7 @@ #include "transaction.h" #include "table_client.h" -namespace NYdb::NTable { +namespace NYdb::inline V3::NTable { TTransaction::TImpl::TImpl(const TSession& session, const std::string& txId) : Session_(session) diff --git a/src/client/table/impl/transaction.h b/src/client/table/impl/transaction.h index 6cf46756416..c226d8ca350 100644 --- a/src/client/table/impl/transaction.h +++ b/src/client/table/impl/transaction.h @@ -2,7 +2,7 @@ #include -namespace NYdb::NTable { +namespace NYdb::inline V3::NTable { class TTransaction::TImpl { public: diff --git a/src/client/table/proto_accessor.cpp b/src/client/table/proto_accessor.cpp index 47f323a0f84..98224b2578d 100644 --- a/src/client/table/proto_accessor.cpp +++ b/src/client/table/proto_accessor.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { const Ydb::TableStats::QueryStats& TProtoAccessor::GetProto(const NTable::TQueryStats& queryStats) { return queryStats.GetProto(); diff --git a/src/client/table/query_stats/stats.cpp b/src/client/table/query_stats/stats.cpp index 53783155b14..cf683df9824 100644 --- a/src/client/table/query_stats/stats.cpp +++ b/src/client/table/query_stats/stats.cpp @@ -1,6 +1,6 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NTable { std::optional ParseQueryStatsMode(std::string_view statsMode) diff --git a/src/client/table/table.cpp b/src/client/table/table.cpp index 0e1f3dc3e39..8b2256200ac 100644 --- a/src/client/table/table.cpp +++ b/src/client/table/table.cpp @@ -33,7 +33,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace NTable { using namespace NThreading; @@ -2817,10 +2817,10 @@ TChangefeedDescription TChangefeedDescription::FromProto(const TProto& proto) { return ret; } -void TChangefeedDescription::SerializeTo(Ydb::Table::Changefeed& proto) const { +template +void TChangefeedDescription::SerializeCommonFields(TProto& proto) const { proto.set_name(TStringType{Name_}); proto.set_virtual_timestamps(VirtualTimestamps_); - proto.set_initial_scan(InitialScan_); proto.set_aws_region(TStringType{AwsRegion_}); switch (Mode_) { @@ -2861,12 +2861,35 @@ void TChangefeedDescription::SerializeTo(Ydb::Table::Changefeed& proto) const { SetDuration(*ResolvedTimestamps_, *proto.mutable_resolved_timestamps_interval()); } + for (const auto& [key, value] : Attributes_) { + (*proto.mutable_attributes())[key] = value; + } +} + +void TChangefeedDescription::SerializeTo(Ydb::Table::Changefeed& proto) const { + SerializeCommonFields(proto); + proto.set_initial_scan(InitialScan_); + if (RetentionPeriod_) { SetDuration(*RetentionPeriod_, *proto.mutable_retention_period()); } +} - for (const auto& [key, value] : Attributes_) { - (*proto.mutable_attributes())[key] = value; +void TChangefeedDescription::SerializeTo(Ydb::Table::ChangefeedDescription& proto) const { + SerializeCommonFields(proto); + + switch (State_) { + case EChangefeedState::Enabled: + proto.set_state(Ydb::Table::ChangefeedDescription_State::ChangefeedDescription_State_STATE_ENABLED); + break; + case EChangefeedState::Disabled: + proto.set_state(Ydb::Table::ChangefeedDescription_State::ChangefeedDescription_State_STATE_DISABLED); + break; + case EChangefeedState::InitialScan: + proto.set_state(Ydb::Table::ChangefeedDescription_State::ChangefeedDescription_State_STATE_INITIAL_SCAN); + break; + case EChangefeedState::Unknown: + break; } } diff --git a/src/client/topic/codecs/codecs.cpp b/src/client/topic/codecs/codecs.cpp index 8e4fd023989..14c5eddead6 100644 --- a/src/client/topic/codecs/codecs.cpp +++ b/src/client/topic/codecs/codecs.cpp @@ -5,7 +5,7 @@ #include #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { namespace { diff --git a/src/client/topic/common/callback_context.h b/src/client/topic/common/callback_context.h index 3a86fb55b85..a6789ee27f5 100644 --- a/src/client/topic/common/callback_context.h +++ b/src/client/topic/common/callback_context.h @@ -10,7 +10,7 @@ #include #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { template class TContextOwner; diff --git a/src/client/topic/common/executor_impl.cpp b/src/client/topic/common/executor_impl.cpp index 676aa1d9dc9..39c56acb329 100644 --- a/src/client/topic/common/executor_impl.cpp +++ b/src/client/topic/common/executor_impl.cpp @@ -1,6 +1,6 @@ #include "executor_impl.h" -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { void IAsyncExecutor::Post(TFunction&& f) { PostImpl(std::move(f)); diff --git a/src/client/topic/common/executor_impl.h b/src/client/topic/common/executor_impl.h index f223b97a832..cd06370e667 100644 --- a/src/client/topic/common/executor_impl.h +++ b/src/client/topic/common/executor_impl.h @@ -7,7 +7,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { class IAsyncExecutor : public IExecutor { private: diff --git a/src/client/topic/common/retry_policy.cpp b/src/client/topic/common/retry_policy.cpp index 8817616f860..a2bac4767a2 100644 --- a/src/client/topic/common/retry_policy.cpp +++ b/src/client/topic/common/retry_policy.cpp @@ -1,7 +1,7 @@ #include #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { IRetryPolicy::TPtr IRetryPolicy::GetDefaultPolicy() { static IRetryPolicy::TPtr policy = GetExponentialBackoffPolicy(); diff --git a/src/client/topic/impl/common.cpp b/src/client/topic/impl/common.cpp index 160682edfac..5b3be0554b1 100644 --- a/src/client/topic/impl/common.cpp +++ b/src/client/topic/impl/common.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { ERetryErrorClass GetRetryErrorClass(EStatus status) { switch (status) { diff --git a/src/client/topic/impl/common.h b/src/client/topic/impl/common.h index cca058c759e..0445589cbda 100644 --- a/src/client/topic/impl/common.h +++ b/src/client/topic/impl/common.h @@ -10,7 +10,7 @@ #include #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { ERetryErrorClass GetRetryErrorClass(EStatus status); ERetryErrorClass GetRetryErrorClassV2(EStatus status); diff --git a/src/client/topic/impl/counters_logger.h b/src/client/topic/impl/counters_logger.h index b68bd64b718..9edc26a6b20 100644 --- a/src/client/topic/impl/counters_logger.h +++ b/src/client/topic/impl/counters_logger.h @@ -8,7 +8,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { template class TSingleClusterReadSessionImpl; diff --git a/src/client/topic/impl/deferred_commit.cpp b/src/client/topic/impl/deferred_commit.cpp index 128e56cf089..53e10bfd156 100644 --- a/src/client/topic/impl/deferred_commit.cpp +++ b/src/client/topic/impl/deferred_commit.cpp @@ -4,7 +4,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { std::pair GetMessageOffsetRange(const TReadSessionEvent::TDataReceivedEvent& dataReceivedEvent, uint64_t index); diff --git a/src/client/topic/impl/event_handlers.cpp b/src/client/topic/impl/event_handlers.cpp index 259a7ed707e..1a4fad20fa0 100644 --- a/src/client/topic/impl/event_handlers.cpp +++ b/src/client/topic/impl/event_handlers.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { std::pair GetMessageOffsetRange(const TReadSessionEvent::TDataReceivedEvent& dataReceivedEvent, uint64_t index); diff --git a/src/client/topic/impl/offsets_collector.cpp b/src/client/topic/impl/offsets_collector.cpp index ea3ead27760..b846ccf703c 100644 --- a/src/client/topic/impl/offsets_collector.cpp +++ b/src/client/topic/impl/offsets_collector.cpp @@ -1,6 +1,6 @@ #include "offsets_collector.h" -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { std::vector TOffsetsCollector::GetOffsets() const { diff --git a/src/client/topic/impl/offsets_collector.h b/src/client/topic/impl/offsets_collector.h index 281d01c1f6c..3e18087051e 100644 --- a/src/client/topic/impl/offsets_collector.h +++ b/src/client/topic/impl/offsets_collector.h @@ -14,7 +14,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { class TOffsetsCollector { public: diff --git a/src/client/topic/impl/read_session.cpp b/src/client/topic/impl/read_session.cpp index 0c80f72ca6f..e73ce3f4033 100644 --- a/src/client/topic/impl/read_session.cpp +++ b/src/client/topic/impl/read_session.cpp @@ -7,7 +7,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { static const std::string DRIVER_IS_STOPPING_DESCRIPTION = "Driver is stopping"; diff --git a/src/client/topic/impl/read_session.h b/src/client/topic/impl/read_session.h index 54d044127f7..21cf15479cf 100644 --- a/src/client/topic/impl/read_session.h +++ b/src/client/topic/impl/read_session.h @@ -6,7 +6,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { class TReadSession : public IReadSession { public: diff --git a/src/client/topic/impl/read_session_event.cpp b/src/client/topic/impl/read_session_event.cpp index 4895167d418..8eb8858e84b 100644 --- a/src/client/topic/impl/read_session_event.cpp +++ b/src/client/topic/impl/read_session_event.cpp @@ -3,7 +3,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Aliases for event types diff --git a/src/client/topic/impl/read_session_impl.h b/src/client/topic/impl/read_session_impl.h index 40e1b4535f6..acc7f8a4ce7 100644 --- a/src/client/topic/impl/read_session_impl.h +++ b/src/client/topic/impl/read_session_impl.h @@ -30,7 +30,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { template using TClientMessage = std::conditional_t -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { static const bool RangesMode = !std::string{std::getenv("PQ_OFFSET_RANGES_MODE") ? std::getenv("PQ_OFFSET_RANGES_MODE") : ""}.empty(); diff --git a/src/client/topic/impl/topic.cpp b/src/client/topic/impl/topic.cpp index 677a75b96bb..ea3d0b59ee6 100644 --- a/src/client/topic/impl/topic.cpp +++ b/src/client/topic/impl/topic.cpp @@ -9,7 +9,7 @@ #include #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { class TCommonCodecsProvider { public: @@ -351,6 +351,9 @@ TPartitionConsumerStats::TPartitionConsumerStats(const Ydb::Topic::DescribeConsu , LastReadOffset_(partitionStats.last_read_offset()) , ReaderName_(partitionStats.reader_name()) , ReadSessionId_(partitionStats.read_session_id()) + , LastReadTime_(TInstant::Seconds(partitionStats.last_read_time().seconds())) + , MaxReadTimeLag_(TDuration::Seconds(partitionStats.max_read_time_lag().seconds())) + , MaxWriteTimeLag_(TDuration::Seconds(partitionStats.max_write_time_lag().seconds())) {} uint64_t TPartitionConsumerStats::GetCommittedOffset() const { @@ -369,6 +372,18 @@ std::string TPartitionConsumerStats::GetReadSessionId() const { return ReadSessionId_; } +const TInstant& TPartitionConsumerStats::GetLastReadTime() const { + return LastReadTime_; +} + +const TDuration& TPartitionConsumerStats::GetMaxReadTimeLag() const { + return MaxReadTimeLag_; +} + +const TDuration& TPartitionConsumerStats::GetMaxWriteTimeLag() const { + return MaxWriteTimeLag_; +} + TPartitionLocation::TPartitionLocation(const Ydb::Topic::PartitionLocation& partitionLocation) : NodeId_(partitionLocation.node_id()) , Generation_(partitionLocation.generation()) diff --git a/src/client/topic/impl/topic_impl.cpp b/src/client/topic/impl/topic_impl.cpp index 8e65f646bb7..b0ace7334fe 100644 --- a/src/client/topic/impl/topic_impl.cpp +++ b/src/client/topic/impl/topic_impl.cpp @@ -3,7 +3,7 @@ #include "read_session.h" #include "write_session.h" -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { std::shared_ptr TTopicClient::TImpl::CreateReadSession(const TReadSessionSettings& settings) { std::optional maybeSettings; diff --git a/src/client/topic/impl/topic_impl.h b/src/client/topic/impl/topic_impl.h index b820a46fa73..494bd07294e 100644 --- a/src/client/topic/impl/topic_impl.h +++ b/src/client/topic/impl/topic_impl.h @@ -13,7 +13,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { struct TOffsetsRange { ui64 Start; ui64 End; diff --git a/src/client/topic/impl/transaction.cpp b/src/client/topic/impl/transaction.cpp index d912bc54fd6..662a4e61218 100644 --- a/src/client/topic/impl/transaction.cpp +++ b/src/client/topic/impl/transaction.cpp @@ -1,7 +1,7 @@ #include "transaction.h" #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { TTransactionId MakeTransactionId(const NTable::TTransaction& tx) { diff --git a/src/client/topic/impl/transaction.h b/src/client/topic/impl/transaction.h index 27d9672c499..721ecf61938 100644 --- a/src/client/topic/impl/transaction.h +++ b/src/client/topic/impl/transaction.h @@ -2,13 +2,13 @@ #include -namespace NYdb::NTable { +namespace NYdb::inline V3::NTable { class TTransaction; } -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { using TTransactionId = std::pair; diff --git a/src/client/topic/impl/write_session.cpp b/src/client/topic/impl/write_session.cpp index c8edb06021d..b19d03eae48 100644 --- a/src/client/topic/impl/write_session.cpp +++ b/src/client/topic/impl/write_session.cpp @@ -2,7 +2,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // TWriteSession diff --git a/src/client/topic/impl/write_session.h b/src/client/topic/impl/write_session.h index 25e77477ddd..77beb2898df 100644 --- a/src/client/topic/impl/write_session.h +++ b/src/client/topic/impl/write_session.h @@ -8,7 +8,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // TWriteSession diff --git a/src/client/topic/impl/write_session_impl.cpp b/src/client/topic/impl/write_session_impl.cpp index 016d3c5860a..0401e17f43d 100644 --- a/src/client/topic/impl/write_session_impl.cpp +++ b/src/client/topic/impl/write_session_impl.cpp @@ -12,7 +12,7 @@ #include #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { const TDuration UPDATE_TOKEN_PERIOD = TDuration::Hours(1); // Error code from file ydb/public/api/protos/persqueue_error_codes_v1.proto diff --git a/src/client/topic/impl/write_session_impl.h b/src/client/topic/impl/write_session_impl.h index 56d9692ba33..448134b60f4 100644 --- a/src/client/topic/impl/write_session_impl.h +++ b/src/client/topic/impl/write_session_impl.h @@ -9,7 +9,7 @@ #include -namespace NYdb::NTopic { +namespace NYdb::inline V3::NTopic { class TWriteSessionEventsQueue: public TBaseSessionEventsQueue { using TParent = TBaseSessionEventsQueue; diff --git a/src/client/topic/proto_accessor.cpp b/src/client/topic/proto_accessor.cpp index c0147f19f7f..4b333ca7bdd 100644 --- a/src/client/topic/proto_accessor.cpp +++ b/src/client/topic/proto_accessor.cpp @@ -1,6 +1,6 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { const Ydb::Topic::DescribeTopicResult& TProtoAccessor::GetProto(const NTopic::TTopicDescription& topicDescription) { return topicDescription.GetProto(); } diff --git a/src/client/topic/ut/describe_topic_ut.cpp b/src/client/topic/ut/describe_topic_ut.cpp index 4ab9c395855..39ae21ecbe1 100644 --- a/src/client/topic/ut/describe_topic_ut.cpp +++ b/src/client/topic/ut/describe_topic_ut.cpp @@ -146,6 +146,7 @@ namespace NYdb::NTopic::NTests { UNIT_ASSERT_GT(consumerStats->GetCommittedOffset(), 0); UNIT_ASSERT_GE(TString{consumerStats->GetReadSessionId()}, 0); UNIT_ASSERT_VALUES_EQUAL(consumerStats->GetReaderName(), ""); + UNIT_ASSERT_GE(consumerStats->GetMaxWriteTimeLag(), TDuration::Seconds(100)); } else { UNIT_ASSERT_VALUES_EQUAL(stats->GetStartOffset(), 0); UNIT_ASSERT_VALUES_EQUAL(consumerStats->GetLastReadOffset(), 0); @@ -284,7 +285,7 @@ namespace NYdb::NTopic::NTests { std::string message(32_MB, 'x'); for(size_t i = 0; i < messagesCount; ++i) { - UNIT_ASSERT(writeSession->Write(message)); + UNIT_ASSERT(writeSession->Write(message, {}, TInstant::Now() - TDuration::Seconds(100))); } writeSession->Close(); } @@ -326,7 +327,21 @@ namespace NYdb::NTopic::NTests { } } + // Additional write + { + auto writeSettings = TWriteSessionSettings().Path(TEST_TOPIC).MessageGroupId(TEST_MESSAGE_GROUP_ID).Codec(ECodec::RAW); + auto writeSession = client.CreateSimpleBlockingWriteSession(writeSettings); + std::string message(32, 'x'); + + for(size_t i = 0; i < messagesCount; ++i) { + UNIT_ASSERT(writeSession->Write(message)); + } + writeSession->Close(); + } + Sleep(TDuration::Seconds(3)); + // Get non-empty description + DescribeTopic(setup, client, true, true, false, false); DescribeConsumer(setup, client, true, true, false, false); DescribePartition(setup, client, true, true, false, false); diff --git a/src/client/topic/ut/topic_to_table_ut.cpp b/src/client/topic/ut/topic_to_table_ut.cpp index fb77fbae99d..6b650975137 100644 --- a/src/client/topic/ut/topic_to_table_ut.cpp +++ b/src/client/topic/ut/topic_to_table_ut.cpp @@ -192,9 +192,9 @@ class TFixture : public NUnitTest::TBaseFixture { NTable::TDataQueryResult ExecuteDataQuery(NTable::TSession session, const TString& query, const NTable::TTxControl& control); - void Read_Exactly_N_Messages_From_Topic(const TString& topicPath, - const TString& consumerName, - size_t count); + TVector Read_Exactly_N_Messages_From_Topic(const TString& topicPath, + const TString& consumerName, + size_t count); struct TAvgWriteBytes { ui64 PerSec = 0; @@ -1069,16 +1069,22 @@ void TFixture::RestartLongTxService() } } -void TFixture::Read_Exactly_N_Messages_From_Topic(const TString& topicPath, - const TString& consumerName, - size_t limit) +TVector TFixture::Read_Exactly_N_Messages_From_Topic(const TString& topicPath, + const TString& consumerName, + size_t limit) { - size_t count = 0; - while (count < limit) { + TVector result; + + while (result.size() < limit) { auto messages = ReadFromTopic(topicPath, consumerName, TDuration::Seconds(2)); - count += messages.size(); + for (auto& m : messages) { + result.push_back(std::move(m)); + } } - UNIT_ASSERT_VALUES_EQUAL(count, limit); + + UNIT_ASSERT_VALUES_EQUAL(result.size(), limit); + + return result; } auto TFixture::GetAvgWriteBytes(const TString& topicName, @@ -1141,15 +1147,13 @@ Y_UNIT_TEST_F(WriteToTopic_Demo_1, TFixture) CommitTx(tx, EStatus::SUCCESS); { - auto messages = ReadFromTopic("topic_A", TEST_CONSUMER, TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 4); + auto messages = Read_Exactly_N_Messages_From_Topic("topic_A", TEST_CONSUMER, 4); UNIT_ASSERT_VALUES_EQUAL(messages[0], "message #1"); UNIT_ASSERT_VALUES_EQUAL(messages[3], "message #4"); } { - auto messages = ReadFromTopic("topic_B", TEST_CONSUMER, TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 5); + auto messages = Read_Exactly_N_Messages_From_Topic("topic_B", TEST_CONSUMER, 5); UNIT_ASSERT_VALUES_EQUAL(messages[0], "message #5"); UNIT_ASSERT_VALUES_EQUAL(messages[4], "message #9"); } @@ -1190,15 +1194,13 @@ Y_UNIT_TEST_F(WriteToTopic_Demo_2, TFixture) CommitTx(tx, EStatus::SUCCESS); { - auto messages = ReadFromTopic("topic_A", TEST_CONSUMER, TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 4); + auto messages = Read_Exactly_N_Messages_From_Topic("topic_A", TEST_CONSUMER, 4); UNIT_ASSERT_VALUES_EQUAL(messages[0], "message #1"); UNIT_ASSERT_VALUES_EQUAL(messages[3], "message #4"); } { - auto messages = ReadFromTopic("topic_B", TEST_CONSUMER, TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 3); + auto messages = Read_Exactly_N_Messages_From_Topic("topic_B", TEST_CONSUMER, 3); UNIT_ASSERT_VALUES_EQUAL(messages[0], "message #7"); UNIT_ASSERT_VALUES_EQUAL(messages[2], "message #9"); } @@ -1299,15 +1301,13 @@ Y_UNIT_TEST_F(WriteToTopic_Demo_5, TFixture) } { - auto messages = ReadFromTopic("topic_A", TEST_CONSUMER, TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 2); + auto messages = Read_Exactly_N_Messages_From_Topic("topic_A", TEST_CONSUMER, 2); UNIT_ASSERT_VALUES_EQUAL(messages[0], "message #1"); UNIT_ASSERT_VALUES_EQUAL(messages[1], "message #3"); } { - auto messages = ReadFromTopic("topic_B", TEST_CONSUMER, TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 2); + auto messages = Read_Exactly_N_Messages_From_Topic("topic_B", TEST_CONSUMER, 2); UNIT_ASSERT_VALUES_EQUAL(messages[0], "message #2"); UNIT_ASSERT_VALUES_EQUAL(messages[1], "message #4"); } @@ -1331,8 +1331,7 @@ Y_UNIT_TEST_F(WriteToTopic_Demo_6, TFixture) CommitTx(tx, EStatus::SUCCESS); { - auto messages = ReadFromTopic("topic_A", TEST_CONSUMER, TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 2); + auto messages = Read_Exactly_N_Messages_From_Topic("topic_A", TEST_CONSUMER, 2); UNIT_ASSERT_VALUES_EQUAL(messages[0], "message #1"); UNIT_ASSERT_VALUES_EQUAL(messages[1], "message #2"); } @@ -1357,8 +1356,7 @@ Y_UNIT_TEST_F(WriteToTopic_Demo_7, TFixture) WriteToTopic("topic_A", TEST_MESSAGE_GROUP_ID_1, "message #6", &tx); { - auto messages = ReadFromTopic("topic_A", TEST_CONSUMER, TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 2); + auto messages = Read_Exactly_N_Messages_From_Topic("topic_A", TEST_CONSUMER, 2); UNIT_ASSERT_VALUES_EQUAL(messages[0], "message #3"); UNIT_ASSERT_VALUES_EQUAL(messages[1], "message #4"); } @@ -1366,8 +1364,7 @@ Y_UNIT_TEST_F(WriteToTopic_Demo_7, TFixture) CommitTx(tx, EStatus::SUCCESS); { - auto messages = ReadFromTopic("topic_A", TEST_CONSUMER, TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 4); + auto messages = Read_Exactly_N_Messages_From_Topic("topic_A", TEST_CONSUMER, 4); UNIT_ASSERT_VALUES_EQUAL(messages[0], "message #1"); UNIT_ASSERT_VALUES_EQUAL(messages[3], "message #6"); } @@ -1456,8 +1453,7 @@ Y_UNIT_TEST_F(WriteToTopic_Demo_10, TFixture) } { - auto messages = ReadFromTopic("topic_A", TEST_CONSUMER, TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 2); + auto messages = Read_Exactly_N_Messages_From_Topic("topic_A", TEST_CONSUMER, 2); UNIT_ASSERT_VALUES_EQUAL(messages[0], "message #1"); UNIT_ASSERT_VALUES_EQUAL(messages[1], "message #2"); } @@ -1753,8 +1749,7 @@ Y_UNIT_TEST_F(WriteToTopic_Demo_15, TFixture) CommitTx(tx, EStatus::SUCCESS); - auto messages = ReadFromTopic("topic_A", TEST_CONSUMER, TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 2); + auto messages = Read_Exactly_N_Messages_From_Topic("topic_A", TEST_CONSUMER, 2); UNIT_ASSERT_VALUES_EQUAL(messages[0], "message #1"); UNIT_ASSERT_VALUES_EQUAL(messages[1], "message #2"); } @@ -1773,8 +1768,7 @@ Y_UNIT_TEST_F(WriteToTopic_Demo_16, TFixture) CommitTx(tx, EStatus::SUCCESS); - auto messages = ReadFromTopic("topic_A", TEST_CONSUMER, TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 2); + auto messages = Read_Exactly_N_Messages_From_Topic("topic_A", TEST_CONSUMER, 2); UNIT_ASSERT_VALUES_EQUAL(messages[0], "message #1"); UNIT_ASSERT_VALUES_EQUAL(messages[1], "message #2"); } @@ -1800,8 +1794,7 @@ Y_UNIT_TEST_F(WriteToTopic_Demo_17, TFixture) //RestartPQTablet("topic_A", 0); - auto messages = ReadFromTopic("topic_A", TEST_CONSUMER, TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 8); + auto messages = Read_Exactly_N_Messages_From_Topic("topic_A", TEST_CONSUMER, 8); UNIT_ASSERT_VALUES_EQUAL(messages[0].size(), 22'000'000); UNIT_ASSERT_VALUES_EQUAL(messages[1].size(), 100); UNIT_ASSERT_VALUES_EQUAL(messages[2].size(), 200); @@ -2033,8 +2026,7 @@ Y_UNIT_TEST_F(WriteToTopic_Demo_25, TFixture) CommitTx(tx, EStatus::SUCCESS); - messages = ReadFromTopic("topic_B", TEST_CONSUMER, TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 3); + Read_Exactly_N_Messages_From_Topic("topic_B", TEST_CONSUMER, 3); } Y_UNIT_TEST_F(WriteToTopic_Demo_26, TFixture) @@ -2219,8 +2211,7 @@ Y_UNIT_TEST_F(WriteToTopic_Demo_39, TFixture) CommitTx(tx, EStatus::SUCCESS); - auto messages = ReadFromTopic("topic_A", "consumer", TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 2); + Read_Exactly_N_Messages_From_Topic("topic_A", "consumer", 2); } Y_UNIT_TEST_F(ReadRuleGeneration, TFixture) @@ -2240,8 +2231,7 @@ Y_UNIT_TEST_F(ReadRuleGeneration, TFixture) AddConsumer(TString{TEST_TOPIC}, {"consumer-1"}); // We read messages from the topic and committed offsets - auto messages = ReadFromTopic(TString{TEST_TOPIC}, "consumer-1", TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 3); + Read_Exactly_N_Messages_From_Topic(TString{TEST_TOPIC}, "consumer-1", 3); CloseTopicReadSession(TString{TEST_TOPIC}, "consumer-1"); // And then the Logbroker team turned on the feature flag @@ -2254,8 +2244,7 @@ Y_UNIT_TEST_F(ReadRuleGeneration, TFixture) AddConsumer(TString{TEST_TOPIC}, {"consumer-2"}); // And they wanted to continue reading their messages - messages = ReadFromTopic(TString{TEST_TOPIC}, "consumer-1", TDuration::Seconds(2)); - UNIT_ASSERT_VALUES_EQUAL(messages.size(), 1); + Read_Exactly_N_Messages_From_Topic(TString{TEST_TOPIC}, "consumer-1", 1); } Y_UNIT_TEST_F(WriteToTopic_Demo_40, TFixture) diff --git a/src/client/types/core_facility/core_facility.h b/src/client/types/core_facility/core_facility.h index 33556b59821..772512bdb6b 100644 --- a/src/client/types/core_facility/core_facility.h +++ b/src/client/types/core_facility/core_facility.h @@ -3,7 +3,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { using TPeriodicCb = std::function; // !!!Experimental!!! diff --git a/src/client/types/credentials/credentials.cpp b/src/client/types/credentials/credentials.cpp index d75916cae8a..2a3e0a83a94 100644 --- a/src/client/types/credentials/credentials.cpp +++ b/src/client/types/credentials/credentials.cpp @@ -1,7 +1,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { class TInsecureCredentialsProvider : public ICredentialsProvider { public: diff --git a/src/client/types/credentials/login/login.cpp b/src/client/types/credentials/login/login.cpp index f6b7b3534ea..c6985d11e4b 100644 --- a/src/client/types/credentials/login/login.cpp +++ b/src/client/types/credentials/login/login.cpp @@ -9,7 +9,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace { diff --git a/src/client/types/credentials/oauth2_token_exchange/credentials.cpp b/src/client/types/credentials/oauth2_token_exchange/credentials.cpp index a780fa8e68a..081b52a0dca 100644 --- a/src/client/types/credentials/oauth2_token_exchange/credentials.cpp +++ b/src/client/types/credentials/oauth2_token_exchange/credentials.cpp @@ -20,7 +20,7 @@ #define INV_ARG "Invalid argument for " PROV_ERR #define EXCH_ERR "Exchange token error in " PROV_ERR -namespace NYdb { +namespace NYdb::inline V3 { namespace { diff --git a/src/client/types/credentials/oauth2_token_exchange/from_file.cpp b/src/client/types/credentials/oauth2_token_exchange/from_file.cpp index c4b23569c89..b8b4fc889c3 100644 --- a/src/client/types/credentials/oauth2_token_exchange/from_file.cpp +++ b/src/client/types/credentials/oauth2_token_exchange/from_file.cpp @@ -13,7 +13,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { namespace { diff --git a/src/client/types/credentials/oauth2_token_exchange/jwt_token_source.cpp b/src/client/types/credentials/oauth2_token_exchange/jwt_token_source.cpp index 5001f9e028c..09bca9a42d9 100644 --- a/src/client/types/credentials/oauth2_token_exchange/jwt_token_source.cpp +++ b/src/client/types/credentials/oauth2_token_exchange/jwt_token_source.cpp @@ -6,7 +6,7 @@ #define INV_ARG "Invalid argument for JWT token source: " -namespace NYdb { +namespace NYdb::inline V3 { #ifdef YDB_SDK_USE_NEW_JWT using TJwtCppStorage = std::vector; diff --git a/src/client/types/exceptions/exceptions.cpp b/src/client/types/exceptions/exceptions.cpp index 47299560e2c..f425e342cf0 100644 --- a/src/client/types/exceptions/exceptions.cpp +++ b/src/client/types/exceptions/exceptions.cpp @@ -1,6 +1,6 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { TYdbException::TYdbException(const std::string& reason) { Append(reason); diff --git a/src/client/types/fatal_error_handlers/handlers.cpp b/src/client/types/fatal_error_handlers/handlers.cpp index 438453f2e60..66fdb71f0d4 100644 --- a/src/client/types/fatal_error_handlers/handlers.cpp +++ b/src/client/types/fatal_error_handlers/handlers.cpp @@ -1,7 +1,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { void ThrowFatalError(const std::string& str) { throw TContractViolation(str); diff --git a/src/client/types/operation/operation.cpp b/src/client/types/operation/operation.cpp index c325f465e7f..975cdb88916 100644 --- a/src/client/types/operation/operation.cpp +++ b/src/client/types/operation/operation.cpp @@ -7,7 +7,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { class TOperation::TImpl { diff --git a/src/client/types/status/status.cpp b/src/client/types/status/status.cpp index ee7db9149a0..1764499e40d 100644 --- a/src/client/types/status/status.cpp +++ b/src/client/types/status/status.cpp @@ -8,7 +8,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { class TStatus::TImpl { public: @@ -99,4 +99,26 @@ bool TStreamPartStatus::EOS() const { return GetStatus() == EStatus::CLIENT_OUT_OF_RANGE; } +//////////////////////////////////////////////////////////////////////////////// + +namespace NStatusHelpers { + +void ThrowOnError(TStatus status, std::function onSuccess) { + if (!status.IsSuccess()) { + throw TYdbErrorException(status) << status; + } else { + onSuccess(status); + } +} + +void ThrowOnErrorOrPrintIssues(TStatus status) { + ThrowOnError(status, [](TStatus status) { + if (status.GetIssues()) { + std::cerr << ToString(status); + } + }); +} + +} + } // namespace NYdb diff --git a/src/client/value/value.cpp b/src/client/value/value.cpp index 7c3665cb280..a6a9e7f9513 100644 --- a/src/client/value/value.cpp +++ b/src/client/value/value.cpp @@ -19,7 +19,7 @@ #include #include -namespace NYdb { +namespace NYdb::inline V3 { static void CheckKind(TTypeParser::ETypeKind actual, TTypeParser::ETypeKind expected, const std::string& method) { diff --git a/tests/integration/basic_example_it/basic_example.cpp b/tests/integration/basic_example_it/basic_example.cpp index c8a2eb8b888..f712001a551 100644 --- a/tests/integration/basic_example_it/basic_example.cpp +++ b/tests/integration/basic_example_it/basic_example.cpp @@ -7,12 +7,6 @@ using namespace NYdb::NTable; -void ThrowOnError(const NYdb::TStatus& status) { - if (!status.IsSuccess()) { - throw TYdbErrorException(status) << status; - } -} - static std::string JoinPath(const std::string& basePath, const std::string& path) { if (basePath.empty()) { return path; @@ -41,7 +35,7 @@ TRunArgs GetRunArgs() { //! Creates sample tables with CrateTable API. void CreateTables(TTableClient client, const std::string& path) { - ThrowOnError(client.RetryOperationSync([path](TSession session) { + NYdb::NStatusHelpers::ThrowOnError(client.RetryOperationSync([path](TSession session) { auto seriesDesc = TTableBuilder() .AddNullableColumn("series_id", NYdb::EPrimitiveType::Uint64) .AddNullableColumn("title", NYdb::EPrimitiveType::Utf8) @@ -53,7 +47,7 @@ void CreateTables(TTableClient client, const std::string& path) { return session.CreateTable(JoinPath(path, "series"), std::move(seriesDesc)).GetValueSync(); })); - ThrowOnError(client.RetryOperationSync([path](TSession session) { + NYdb::NStatusHelpers::ThrowOnError(client.RetryOperationSync([path](TSession session) { auto seasonsDesc = TTableBuilder() .AddNullableColumn("series_id", NYdb::EPrimitiveType::Uint64) .AddNullableColumn("season_id", NYdb::EPrimitiveType::Uint64) @@ -66,7 +60,7 @@ void CreateTables(TTableClient client, const std::string& path) { return session.CreateTable(JoinPath(path, "seasons"), std::move(seasonsDesc)).GetValueSync(); })); - ThrowOnError(client.RetryOperationSync([path](TSession session) { + NYdb::NStatusHelpers::ThrowOnError(client.RetryOperationSync([path](TSession session) { auto episodesDesc = TTableBuilder() .AddNullableColumn("series_id", NYdb::EPrimitiveType::Uint64) .AddNullableColumn("season_id", NYdb::EPrimitiveType::Uint64) @@ -466,7 +460,7 @@ static NYdb::TStatus ScanQuerySelect(TTableClient client, const std::string& pat NYdb::TResultSet SelectSimple(TTableClient client, const std::string& path) { std::optional resultSet; - ThrowOnError(client.RetryOperationSync([path, &resultSet](TSession session) { + NYdb::NStatusHelpers::ThrowOnError(client.RetryOperationSync([path, &resultSet](TSession session) { return SelectSimpleTransaction(session, path, resultSet); })); @@ -474,14 +468,14 @@ NYdb::TResultSet SelectSimple(TTableClient client, const std::string& path) { } void UpsertSimple(TTableClient client, const std::string& path) { - ThrowOnError(client.RetryOperationSync([path](TSession session) { + NYdb::NStatusHelpers::ThrowOnError(client.RetryOperationSync([path](TSession session) { return UpsertSimpleTransaction(session, path); })); } NYdb::TResultSet SelectWithParams(TTableClient client, const std::string& path) { std::optional resultSet; - ThrowOnError(client.RetryOperationSync([path, &resultSet](TSession session) { + NYdb::NStatusHelpers::ThrowOnError(client.RetryOperationSync([path, &resultSet](TSession session) { return SelectWithParamsTransaction(session, path, 2, 3, resultSet); })); @@ -490,7 +484,7 @@ NYdb::TResultSet SelectWithParams(TTableClient client, const std::string& path) NYdb::TResultSet PreparedSelect(TTableClient client, const std::string& path, ui32 seriesId, ui32 seasonId, ui32 episodeId) { std::optional resultSet; - ThrowOnError(client.RetryOperationSync([path, seriesId, seasonId, episodeId, &resultSet](TSession session) { + NYdb::NStatusHelpers::ThrowOnError(client.RetryOperationSync([path, seriesId, seasonId, episodeId, &resultSet](TSession session) { return PreparedSelectTransaction(session, path, seriesId, seasonId, episodeId, resultSet); })); @@ -499,7 +493,7 @@ NYdb::TResultSet PreparedSelect(TTableClient client, const std::string& path, ui NYdb::TResultSet MultiStep(TTableClient client, const std::string& path) { std::optional resultSet; - ThrowOnError(client.RetryOperationSync([path, &resultSet](TSession session) { + NYdb::NStatusHelpers::ThrowOnError(client.RetryOperationSync([path, &resultSet](TSession session) { return MultiStepTransaction(session, path, 2, 5, resultSet); })); @@ -507,14 +501,14 @@ NYdb::TResultSet MultiStep(TTableClient client, const std::string& path) { } void ExplicitTcl(TTableClient client, const std::string& path) { - ThrowOnError(client.RetryOperationSync([path](TSession session) { + NYdb::NStatusHelpers::ThrowOnError(client.RetryOperationSync([path](TSession session) { return ExplicitTclTransaction(session, path, TInstant()); })); } std::vector ScanQuerySelect(TTableClient client, const std::string& path) { std::vector resultSets; - ThrowOnError(client.RetryOperationSync([path, &resultSets](TTableClient& client) { + NYdb::NStatusHelpers::ThrowOnError(client.RetryOperationSync([path, &resultSets](TTableClient& client) { return ScanQuerySelect(client, path, resultSets); })); diff --git a/tests/integration/basic_example_it/basic_example.h b/tests/integration/basic_example_it/basic_example.h index 6a59cdd2fe7..e35fba69943 100644 --- a/tests/integration/basic_example_it/basic_example.h +++ b/tests/integration/basic_example_it/basic_example.h @@ -13,18 +13,10 @@ struct TRunArgs { NYdb::TDriver driver; std::string path; }; -class TYdbErrorException : public yexception { -public: - TYdbErrorException(const NYdb::TStatus& status) - : Status(status) {} - - NYdb::TStatus Status; -}; NYdb::TParams GetTablesDataParams(); void CreateTables(TTableClient client, const std::string& path); -void ThrowOnError(const NYdb::TStatus& status); TRunArgs GetRunArgs(); NYdb::TStatus FillTableDataTransaction(TSession session, const std::string& path); NYdb::TResultSet SelectSimple(TTableClient client, const std::string& path); diff --git a/tests/integration/basic_example_it/main.cpp b/tests/integration/basic_example_it/main.cpp index 15417a6f45c..4ad89b43778 100644 --- a/tests/integration/basic_example_it/main.cpp +++ b/tests/integration/basic_example_it/main.cpp @@ -46,7 +46,7 @@ TEST(Integration, BasicExample) { try { CreateTables(client, path); - ThrowOnError(client.RetryOperationSync([path](NYdb::NTable::TSession session) { + NYdb::NStatusHelpers::ThrowOnError(client.RetryOperationSync([path](NYdb::NTable::TSession session) { return FillTableDataTransaction(session, path); })); @@ -216,7 +216,7 @@ TEST(Integration, BasicExample) { ASSERT_EQ(result.size(), size_t(1)); ValidateResultSet(columns, values, result[0]); } - } catch (const TYdbErrorException& e) { - FAIL() << "Execution failed due to fatal error:\nStatus: " << ToString(e.Status) << std::endl; + } catch (const NYdb::NStatusHelpers::TYdbErrorException& e) { + FAIL() << "Execution failed due to fatal error:\n" << e.what() << std::endl; } } diff --git a/tests/integration/bulk_upsert_simple_it/bulk_upsert.cpp b/tests/integration/bulk_upsert_simple_it/bulk_upsert.cpp index 29956dd8b09..ce74b1cc16f 100644 --- a/tests/integration/bulk_upsert_simple_it/bulk_upsert.cpp +++ b/tests/integration/bulk_upsert_simple_it/bulk_upsert.cpp @@ -5,12 +5,6 @@ static constexpr size_t BATCH_SIZE = 1000; -static void ThrowOnError(const TStatus& status) { - if (!status.IsSuccess()) { - throw TYdbErrorException(status) << status; - } -} - static std::string JoinPath(const std::string& basePath, const std::string& path) { if (basePath.empty()) { return path; @@ -133,7 +127,7 @@ static TStatus SelectTransaction(TSession session, const std::string& path, TStatistic Select(TTableClient& client, const std::string& path) { std::optional resultSet; - ThrowOnError(client.RetryOperationSync([path, &resultSet](TSession session) { + NStatusHelpers::ThrowOnError(client.RetryOperationSync([path, &resultSet](TSession session) { return SelectTransaction(session, path, resultSet); })); @@ -144,7 +138,7 @@ TStatistic Select(TTableClient& client, const std::string& path) { uint64_t rowCount = 0; if (parser.ColumnsCount() != 3 || parser.RowsCount() != 1) { - throw TYdbErrorException(TStatus(EStatus::GENERIC_ERROR, + throw NStatusHelpers::TYdbErrorException(TStatus(EStatus::GENERIC_ERROR, {NYdb::NIssue::TIssue("The number of columns should be: 3.\nThe number of rows should be: 1")})); } @@ -158,7 +152,7 @@ TStatistic Select(TTableClient& client, const std::string& path) { } void DropTable(TTableClient& client, const std::string& path) { - ThrowOnError(client.RetryOperationSync([path](TSession session) { + NStatusHelpers::ThrowOnError(client.RetryOperationSync([path](TSession session) { return session.DropTable(path).ExtractValueSync(); })); } diff --git a/tests/integration/bulk_upsert_simple_it/bulk_upsert.h b/tests/integration/bulk_upsert_simple_it/bulk_upsert.h index e450973a61b..e6d13a5d7f7 100644 --- a/tests/integration/bulk_upsert_simple_it/bulk_upsert.h +++ b/tests/integration/bulk_upsert_simple_it/bulk_upsert.h @@ -24,14 +24,6 @@ struct TLogMessage { std::string Message; }; -class TYdbErrorException : public yexception { -public: - TYdbErrorException(const NYdb::TStatus& status) - : Status(status) {} - - NYdb::TStatus Status; -}; - struct TStatistic { uint64_t SumApp; uint64_t SumHost; diff --git a/tests/integration/bulk_upsert_simple_it/main.cpp b/tests/integration/bulk_upsert_simple_it/main.cpp index 5342987c71e..589f0ff3d99 100644 --- a/tests/integration/bulk_upsert_simple_it/main.cpp +++ b/tests/integration/bulk_upsert_simple_it/main.cpp @@ -44,12 +44,11 @@ TEST(Integration, BulkUpsert) { EXPECT_EQ(rowCount, correctRowCount); EXPECT_EQ(sumApp, correctSumApp); EXPECT_EQ(sumHost, correctSumHost); - } catch (const TYdbErrorException& e) { + } catch (const NYdb::NStatusHelpers::TYdbErrorException& e) { driver.Stop(true); - FAIL() << "Execution failed due to fatal error:\nStatus: " << ToString(e.Status) << std::endl << e.Status.GetIssues().ToString(); + FAIL() << "Execution failed due to fatal error:\n" << e.what() << std::endl; } - + DropTable(client, path); driver.Stop(true); - } diff --git a/tests/unit/client/draft/helpers/grpc_server.h b/tests/unit/client/draft/helpers/grpc_server.h index c788452cf96..af3a9df8fed 100644 --- a/tests/unit/client/draft/helpers/grpc_server.h +++ b/tests/unit/client/draft/helpers/grpc_server.h @@ -5,7 +5,7 @@ #include -namespace NYdb { +namespace NYdb::inline V3 { template std::unique_ptr StartGrpcServer(const std::string& address, TService& service) { diff --git a/tests/unit/client/draft/helpers/grpc_services/scripting.cpp b/tests/unit/client/draft/helpers/grpc_services/scripting.cpp index 1b172e179a8..f798c054808 100644 --- a/tests/unit/client/draft/helpers/grpc_services/scripting.cpp +++ b/tests/unit/client/draft/helpers/grpc_services/scripting.cpp @@ -1,6 +1,6 @@ #include "scripting.h" -namespace NYdb::NScripting { +namespace NYdb::inline V3::NScripting { grpc::Status TMockSlyDbProxy::ExecuteYql( grpc::ServerContext* context, diff --git a/tests/unit/client/draft/helpers/grpc_services/scripting.h b/tests/unit/client/draft/helpers/grpc_services/scripting.h index 3e46a186f12..432e2085496 100644 --- a/tests/unit/client/draft/helpers/grpc_services/scripting.h +++ b/tests/unit/client/draft/helpers/grpc_services/scripting.h @@ -2,7 +2,7 @@ #include -namespace NYdb::NScripting { +namespace NYdb::inline V3::NScripting { class TMockSlyDbProxy : public Ydb::Scripting::V1::ScriptingService::Service { diff --git a/tests/unit/client/draft/helpers/grpc_services/view.cpp b/tests/unit/client/draft/helpers/grpc_services/view.cpp index 3614fb5e4af..82e7335a9d5 100644 --- a/tests/unit/client/draft/helpers/grpc_services/view.cpp +++ b/tests/unit/client/draft/helpers/grpc_services/view.cpp @@ -1,6 +1,6 @@ #include "view.h" -namespace NYdb::NView { +namespace NYdb::inline V3::NView { grpc::Status TViewDummyService::DescribeView( [[maybe_unused]] grpc::ServerContext* context, diff --git a/tests/unit/client/draft/helpers/grpc_services/view.h b/tests/unit/client/draft/helpers/grpc_services/view.h index 20a66e597fa..e507ba61b65 100644 --- a/tests/unit/client/draft/helpers/grpc_services/view.h +++ b/tests/unit/client/draft/helpers/grpc_services/view.h @@ -2,7 +2,7 @@ #include -namespace NYdb::NView { +namespace NYdb::inline V3::NView { constexpr const char* DummyQueryText = "select 42"; diff --git a/tests/unit/client/draft/ydb_scripting_response_headers_ut.cpp b/tests/unit/client/draft/ydb_scripting_response_headers_ut.cpp index 9e350d19847..342b726b682 100644 --- a/tests/unit/client/draft/ydb_scripting_response_headers_ut.cpp +++ b/tests/unit/client/draft/ydb_scripting_response_headers_ut.cpp @@ -6,7 +6,7 @@ #include using namespace NYdb; -using namespace NYdb::NScripting; +using namespace NYdb::V3::NScripting; Y_UNIT_TEST_SUITE(ResponseHeaders) { Y_UNIT_TEST(PassHeader) { diff --git a/tests/unit/client/draft/ydb_view_ut.cpp b/tests/unit/client/draft/ydb_view_ut.cpp index 94336d1995f..73ea9b90b61 100644 --- a/tests/unit/client/draft/ydb_view_ut.cpp +++ b/tests/unit/client/draft/ydb_view_ut.cpp @@ -6,7 +6,7 @@ #include using namespace NYdb; -using namespace NYdb::NView; +using namespace NYdb::V3::NView; Y_UNIT_TEST_SUITE(ViewClient) { Y_UNIT_TEST(Basic) {