#include <folly/compression/Zstd.h>
#if FOLLY_HAVE_LIBZSTD
#include <stdexcept>
#include <string>
#include <zstd.h>
#include <folly/Conv.h>
#include <folly/Range.h>
#include <folly/ScopeGuard.h>
#include <folly/compression/CompressionContextPoolSingletons.h>
#include <folly/compression/Utils.h>
static_assert …;
dataStartsWithLE;
prefixToStringLE;
usingnamespacefolly::compression::contexts;
namespace folly {
namespace compression {
namespace zstd {
namespace {
size_t zstdThrowIfError(size_t rc) { … }
ZSTD_EndDirective zstdTranslateFlush(StreamCodec::FlushOp flush) { … }
class ZSTDStreamCodec final : public StreamCodec { … };
constexpr uint32_t kZSTDMagicLE = …;
std::vector<std::string> ZSTDStreamCodec::validPrefixes() const { … }
bool ZSTDStreamCodec::canUncompress(
const IOBuf* data, Optional<uint64_t>) const { … }
CodecType codecType(Options const& options) { … }
ZSTDStreamCodec::ZSTDStreamCodec(Options options)
: … { … }
bool ZSTDStreamCodec::doNeedsUncompressedLength() const { … }
uint64_t ZSTDStreamCodec::doMaxCompressedLength(
uint64_t uncompressedLength) const { … }
Optional<uint64_t> ZSTDStreamCodec::doGetUncompressedLength(
IOBuf const* data, Optional<uint64_t> uncompressedLength) const { … }
void ZSTDStreamCodec::doResetStream() { … }
void ZSTDStreamCodec::resetCCtx() { … }
bool ZSTDStreamCodec::doCompressStream(
ByteRange& input, MutableByteRange& output, StreamCodec::FlushOp flushOp) { … }
void ZSTDStreamCodec::resetDCtx() { … }
bool ZSTDStreamCodec::doUncompressStream(
ByteRange& input, MutableByteRange& output, StreamCodec::FlushOp) { … }
}
Options::Options(int level) : … { … }
void Options::set(ZSTD_cParameter param, unsigned value) { … }
void Options::freeCCtxParams(ZSTD_CCtx_params* params) { … }
std::unique_ptr<Codec> getCodec(Options options) { … }
std::unique_ptr<StreamCodec> getStreamCodec(Options options) { … }
}
}
}
#endif