Skip to content

Commit

Permalink
deprecated_codecs options improvements
Browse files Browse the repository at this point in the history
Waiting for pull-request [#616](ytsaurus/ytsaurus#616) to be merged. Then I'll rebase and resolve the conflicts, then this pr will be ready for merge

Discussion led to this pr: [link](ytsaurus/ytsaurus#616 (comment))

---
2816c45b6457268a97dedad1968e6f22ba42df8c

Pull Request resolved: ytsaurus/ytsaurus#629
  • Loading branch information
abogutskiy authored and robot-piglet committed Jun 24, 2024
1 parent f601548 commit 7688f23
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions yt/yt/core/compression/codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,15 +413,15 @@ ICodec* GetCodec(ECodec id)

////////////////////////////////////////////////////////////////////////////////

const THashSet<ECodec>& GetDeprecatedCodecIds()
const THashSet<ECodec>& GetForbiddenCodecs()
{
static const THashSet<ECodec> deprecatedCodecIds{
static const THashSet<ECodec> deprecatedCodecs{
ECodec::QuickLz
};
return deprecatedCodecIds;
return deprecatedCodecs;
}

const THashMap<TString, TString>& GetDeprecatedCodecNameToAlias()
const THashMap<TString, TString>& GetForbiddenCodecNameToAlias()
{
static const THashMap<TString, TString> deprecatedCodecNameToAlias = {
{"zlib6", FormatEnum(ECodec::Zlib_6)},
Expand All @@ -436,19 +436,19 @@ const THashMap<TString, TString>& GetDeprecatedCodecNameToAlias()
return deprecatedCodecNameToAlias;
}

const std::vector<ECodec>& GetSupportedCodecIds()
const std::vector<ECodec>& GetSupportedCodecs()
{
static const std::vector<ECodec> supportedCodecIds = [] {
std::vector<ECodec> supportedCodecIds;
static const std::vector<ECodec> supportedCodecs = [] {
std::vector<ECodec> supportedCodecs;
for (auto codecId : TEnumTraits<ECodec>::GetDomainValues()) {
if (!GetDeprecatedCodecIds().contains(codecId)) {
supportedCodecIds.push_back(codecId);
if (!GetForbiddenCodecs().contains(codecId)) {
supportedCodecs.push_back(codecId);
}
}
SortUnique(supportedCodecIds);
return supportedCodecIds;
SortUnique(supportedCodecs);
return supportedCodecs;
}();
return supportedCodecIds;
return supportedCodecs;
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 3 additions & 3 deletions yt/yt/core/compression/codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ struct ICodec
ICodec* GetCodec(ECodec id);

//! Deprecated codecs information.
const THashSet<ECodec>& GetDeprecatedCodecIds();
const THashMap<TString, TString>& GetDeprecatedCodecNameToAlias();
const std::vector<ECodec>& GetSupportedCodecIds();
const THashSet<ECodec>& GetForbiddenCodecs();
const THashMap<TString, TString>& GetForbiddenCodecNameToAlias();
const std::vector<ECodec>& GetSupportedCodecs();

////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion yt/yt/core/compression/unittests/codec_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ INSTANTIATE_TEST_SUITE_P(
All,
TCodecTest,
::testing::Combine(
::testing::ValuesIn(GetSupportedCodecIds()),
::testing::ValuesIn(GetSupportedCodecs()),
::testing::ValuesIn(std::vector<ui64>({static_cast<ui64>(-1), 1, 1024}))),
[] (const ::testing::TestParamInfo<std::tuple<ECodec, ui64>>& info) -> std::string {
return
Expand Down

0 comments on commit 7688f23

Please sign in to comment.