diff options
author | dvorkanton <dvorkanton@yandex-team.ru> | 2022-02-10 16:46:04 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:04 +0300 |
commit | 110a978b66fe6c0916572df51cfead2a9b647174 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/blockcodecs/codecs/snappy | |
parent | ce1ca0f8ad5b8231d32b35629f85bb09beea1bfb (diff) | |
download | ydb-110a978b66fe6c0916572df51cfead2a9b647174.tar.gz |
Restoring authorship annotation for <dvorkanton@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/blockcodecs/codecs/snappy')
-rw-r--r-- | library/cpp/blockcodecs/codecs/snappy/snappy.cpp | 94 | ||||
-rw-r--r-- | library/cpp/blockcodecs/codecs/snappy/ya.make | 26 |
2 files changed, 60 insertions, 60 deletions
diff --git a/library/cpp/blockcodecs/codecs/snappy/snappy.cpp b/library/cpp/blockcodecs/codecs/snappy/snappy.cpp index 0cacc876de..f6be05a05f 100644 --- a/library/cpp/blockcodecs/codecs/snappy/snappy.cpp +++ b/library/cpp/blockcodecs/codecs/snappy/snappy.cpp @@ -1,52 +1,52 @@ #include <library/cpp/blockcodecs/core/codecs.h> #include <library/cpp/blockcodecs/core/common.h> #include <library/cpp/blockcodecs/core/register.h> - -#include <contrib/libs/snappy/snappy.h> - -using namespace NBlockCodecs; - -namespace { - struct TSnappyCodec: public ICodec { - size_t DecompressedLength(const TData& in) const override { - size_t ret; - - if (snappy::GetUncompressedLength(in.data(), in.size(), &ret)) { - return ret; - } - - ythrow TDecompressError(0); - } - - size_t MaxCompressedLength(const TData& in) const override { - return snappy::MaxCompressedLength(in.size()); - } - - size_t Compress(const TData& in, void* out) const override { - size_t ret; - - snappy::RawCompress(in.data(), in.size(), (char*)out, &ret); - - return ret; - } - - size_t Decompress(const TData& in, void* out) const override { - if (snappy::RawUncompress(in.data(), in.size(), (char*)out)) { - return DecompressedLength(in); - } - - ythrow TDecompressError(0); - } - - TStringBuf Name() const noexcept override { - return "snappy"; - } - }; - - struct TSnappyRegistrar { - TSnappyRegistrar() { + +#include <contrib/libs/snappy/snappy.h> + +using namespace NBlockCodecs; + +namespace { + struct TSnappyCodec: public ICodec { + size_t DecompressedLength(const TData& in) const override { + size_t ret; + + if (snappy::GetUncompressedLength(in.data(), in.size(), &ret)) { + return ret; + } + + ythrow TDecompressError(0); + } + + size_t MaxCompressedLength(const TData& in) const override { + return snappy::MaxCompressedLength(in.size()); + } + + size_t Compress(const TData& in, void* out) const override { + size_t ret; + + snappy::RawCompress(in.data(), in.size(), (char*)out, &ret); + + return ret; + } + + size_t Decompress(const TData& in, void* out) const override { + if (snappy::RawUncompress(in.data(), in.size(), (char*)out)) { + return DecompressedLength(in); + } + + ythrow TDecompressError(0); + } + + TStringBuf Name() const noexcept override { + return "snappy"; + } + }; + + struct TSnappyRegistrar { + TSnappyRegistrar() { RegisterCodec(MakeHolder<TSnappyCodec>()); - } - }; + } + }; const TSnappyRegistrar Registrar{}; -} +} diff --git a/library/cpp/blockcodecs/codecs/snappy/ya.make b/library/cpp/blockcodecs/codecs/snappy/ya.make index d939ef648e..0cf2be2f94 100644 --- a/library/cpp/blockcodecs/codecs/snappy/ya.make +++ b/library/cpp/blockcodecs/codecs/snappy/ya.make @@ -1,14 +1,14 @@ -LIBRARY() - -OWNER(pg) - -PEERDIR( - contrib/libs/snappy +LIBRARY() + +OWNER(pg) + +PEERDIR( + contrib/libs/snappy library/cpp/blockcodecs/core -) - -SRCS( - GLOBAL snappy.cpp -) - -END() +) + +SRCS( + GLOBAL snappy.cpp +) + +END() |