diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/http/io/compression.cpp | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/http/io/compression.cpp')
-rw-r--r-- | library/cpp/http/io/compression.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/library/cpp/http/io/compression.cpp b/library/cpp/http/io/compression.cpp index 8fa1f62ae6..0c922ad566 100644 --- a/library/cpp/http/io/compression.cpp +++ b/library/cpp/http/io/compression.cpp @@ -1,66 +1,66 @@ #include "compression.h" - -#if defined(ENABLE_GPL) + +#if defined(ENABLE_GPL) #include <library/cpp/streams/lz/lz.h> -#endif - +#endif + #include <library/cpp/streams/brotli/brotli.h> #include <library/cpp/streams/lzma/lzma.h> #include <library/cpp/streams/bzip2/bzip2.h> - + #include <library/cpp/blockcodecs/stream.h> #include <library/cpp/blockcodecs/codecs.h> - -#include <util/stream/zlib.h> - - + +#include <util/stream/zlib.h> + + TCompressionCodecFactory::TCompressionCodecFactory() { auto gzip = [](auto s) { return MakeHolder<TZLibDecompress>(s); - }; - + }; + Add("gzip", gzip, [](auto s) { return MakeHolder<TZLibCompress>(s, ZLib::GZip); }); Add("deflate", gzip, [](auto s) { return MakeHolder<TZLibCompress>(s, ZLib::ZLib); }); Add("br", [](auto s) { return MakeHolder<TBrotliDecompress>(s); }, [](auto s) { return MakeHolder<TBrotliCompress>(s, 4); }); Add("x-gzip", gzip, [](auto s) { return MakeHolder<TZLibCompress>(s, ZLib::GZip); }); Add("x-deflate", gzip, [](auto s) { return MakeHolder<TZLibCompress>(s, ZLib::ZLib); }); - -#if defined(ENABLE_GPL) + +#if defined(ENABLE_GPL) const ui16 bs = 32 * 1024; - + Add("y-lzo", [](auto s) { return MakeHolder<TLzoDecompress>(s); }, [bs](auto s) { return MakeHolder<TLazy<TLzoCompress> >(s, bs); }); Add("y-lzf", [](auto s) { return MakeHolder<TLzfDecompress>(s); }, [bs](auto s) { return MakeHolder<TLazy<TLzfCompress> >(s, bs); }); Add("y-lzq", [](auto s) { return MakeHolder<TLzqDecompress>(s); }, [bs](auto s) { return MakeHolder<TLazy<TLzqCompress> >(s, bs); }); -#endif - +#endif + Add("y-bzip2", [](auto s) { return MakeHolder<TBZipDecompress>(s); }, [](auto s) { return MakeHolder<TBZipCompress>(s); }); Add("y-lzma", [](auto s) { return MakeHolder<TLzmaDecompress>(s); }, [](auto s) { return MakeHolder<TLzmaCompress>(s); }); - + for (auto codecName : NBlockCodecs::ListAllCodecs()) { if (codecName.StartsWith("zstd06")) { continue; - } - + } + if (codecName.StartsWith("zstd08")) { continue; - } - + } + auto codec = NBlockCodecs::Codec(codecName); - + auto enc = [codec](auto s) { return MakeHolder<NBlockCodecs::TCodedOutput>(s, codec, 32 * 1024); }; - + auto dec = [codec](auto s) { return MakeHolder<NBlockCodecs::TDecodedInput>(s, codec); - }; - + }; + Add(TString("z-") + codecName, dec, enc); - } -} - + } +} + void TCompressionCodecFactory::Add(TStringBuf name, TDecoderConstructor d, TEncoderConstructor e) { Strings_.emplace_back(name); Codecs_[Strings_.back()] = TCodec{d, e}; BestCodecs_.emplace_back(Strings_.back()); -} +} |