diff options
| author | Bulat <[email protected]> | 2024-08-27 22:11:10 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-08-27 22:11:10 +0300 |
| commit | d1d3fd7dc6429735077d90ce06d00a264fb48126 (patch) | |
| tree | 7d9b18165c66cd22d02c195f6af7523db0cf3952 | |
| parent | 2ca83de571baa002a8a22cb94f70ccc4595b30e9 (diff) | |
Moved NotExistsIsOk setting to recursive remove settings (#8355)
4 files changed, 8 insertions, 6 deletions
diff --git a/ydb/public/lib/ydb_cli/commands/ydb_workload.cpp b/ydb/public/lib/ydb_cli/commands/ydb_workload.cpp index 78150968bf0..ca3297d0ce8 100644 --- a/ydb/public/lib/ydb_cli/commands/ydb_workload.cpp +++ b/ydb/public/lib/ydb_cli/commands/ydb_workload.cpp @@ -384,7 +384,7 @@ int TWorkloadCommandBase::Run(TConfig& config) { void TWorkloadCommandBase::CleanTables(NYdbWorkload::IWorkloadQueryGenerator& workloadGen, TConfig& config) { auto pathsToDelete = workloadGen.GetCleanPaths(); - NScheme::TRemoveDirectorySettings settings; + TRemovePathRecursiveSettings settings; settings.NotExistsIsOk(true); for (const auto& path : pathsToDelete) { Cout << "Remove path " << path << "..." << Endl; diff --git a/ydb/public/lib/ydb_cli/common/recursive_remove.cpp b/ydb/public/lib/ydb_cli/common/recursive_remove.cpp index 21862472bf8..b6351714ee3 100644 --- a/ydb/public/lib/ydb_cli/common/recursive_remove.cpp +++ b/ydb/public/lib/ydb_cli/common/recursive_remove.cpp @@ -195,7 +195,7 @@ TStatus RemoveDirectoryRecursive( return RemoveDirectoryRecursive(schemeClient, &tableClient, &topicClient, path, prompt, settings, removeSelf, createProgressBar); } -NYdb::TStatus RemovePathRecursive(NScheme::TSchemeClient& schemeClient, NTable::TTableClient& tableClient, NTopic::TTopicClient& topicClient, const TString& path, ERecursiveRemovePrompt prompt, const NScheme::TRemoveDirectorySettings& settings /*= {}*/, bool createProgressBar /*= true*/) { +NYdb::TStatus RemovePathRecursive(NScheme::TSchemeClient& schemeClient, NTable::TTableClient& tableClient, NTopic::TTopicClient& topicClient, const TString& path, ERecursiveRemovePrompt prompt, const TRemovePathRecursiveSettings& settings /*= {}*/, bool createProgressBar /*= true*/) { auto entity = schemeClient.DescribePath(path).ExtractValueSync(); if (!entity.IsSuccess()) { if (settings.NotExistsIsOk_ && entity.GetStatus() == EStatus::SCHEME_ERROR && entity.GetIssues().ToString().find("Path not found") != TString::npos) { diff --git a/ydb/public/lib/ydb_cli/common/recursive_remove.h b/ydb/public/lib/ydb_cli/common/recursive_remove.h index 2e303f7cff8..46e577c07af 100644 --- a/ydb/public/lib/ydb_cli/common/recursive_remove.h +++ b/ydb/public/lib/ydb_cli/common/recursive_remove.h @@ -12,6 +12,10 @@ enum class ERecursiveRemovePrompt { Never, }; +struct TRemovePathRecursiveSettings : public NScheme::TRemoveDirectorySettings { + FLUENT_SETTING_DEFAULT(bool, NotExistsIsOk, false); +}; + bool Prompt(ERecursiveRemovePrompt mode, const TString& path, NScheme::ESchemeEntryType type, bool first = true); TStatus RemoveDirectoryRecursive( @@ -38,7 +42,7 @@ TStatus RemovePathRecursive( NTopic::TTopicClient& topicClient, const TString& path, ERecursiveRemovePrompt prompt, - const NScheme::TRemoveDirectorySettings& settings = {}, + const TRemovePathRecursiveSettings& settings = {}, bool createProgressBar = true); } diff --git a/ydb/public/sdk/cpp/client/ydb_scheme/scheme.h b/ydb/public/sdk/cpp/client/ydb_scheme/scheme.h index dae8d30517a..68b8faafc1d 100644 --- a/ydb/public/sdk/cpp/client/ydb_scheme/scheme.h +++ b/ydb/public/sdk/cpp/client/ydb_scheme/scheme.h @@ -99,9 +99,7 @@ using TAsyncListDirectoryResult = NThreading::TFuture<TListDirectoryResult>; struct TMakeDirectorySettings : public TOperationRequestSettings<TMakeDirectorySettings> {}; -struct TRemoveDirectorySettings : public TOperationRequestSettings<TRemoveDirectorySettings> { - FLUENT_SETTING_DEFAULT(bool, NotExistsIsOk, false); -}; +struct TRemoveDirectorySettings : public TOperationRequestSettings<TRemoveDirectorySettings> {}; struct TDescribePathSettings : public TOperationRequestSettings<TDescribePathSettings> {}; |
