15 #include <glog/logging.h> 19 using namespace folly;
31 while (cursor.length() >= 8) {
34 while (cursor.length()) {
41 std::unique_ptr<IOBuf> original,
42 std::unique_ptr<IOBuf> compressed) {
43 auto zd = std::make_unique<ZlibStreamDecompressor>(
type);
45 auto decompressed = zd->decompress(compressed.get());
46 ASSERT_FALSE(zd->hasError()) <<
"Decompression error. r=" << zd->getStatus();
54 unique_ptr<IOBuf> buf) {
56 unique_ptr<IOBuf> compressed;
57 unique_ptr<IOBuf> decompressed;
61 compressed = zc->
compress(buf.get(),
true);
117 std::make_unique<ZlibStreamCompressor>(ZlibCompressionType::GZIP, 6);
120 auto out = compressor->compress(first.get(),
false);
123 out->prev()->appendChain(compressor->compress(second.get(),
false));
124 first->prev()->appendChain(
std::move(second));
127 out->prev()->appendChain(compressor->compress(third.get(),
false));
128 first->prev()->appendChain(
std::move(third));
131 out->prev()->appendChain(compressor->compress(
empty.get(),
true));
139 auto oldFlag = FLAGS_zlib_compressor_buffer_growth;
141 FLAGS_zlib_compressor_buffer_growth = oldFlag;
145 FLAGS_zlib_compressor_buffer_growth = 10;
static std::unique_ptr< IOBuf > create(std::size_t capacity)
std::enable_if< std::is_arithmetic< T >::value >::type write(T value)
std::unique_ptr< folly::IOBuf > compress(const folly::IOBuf *in, bool trailer=true)
constexpr detail::Map< Move > move
—— Concurrent Priority Queue Implementation ——
std::unique_ptr< folly::IOBuf > makeBuf(uint32_t size)
void compressThenDecompress(ZlibCompressionType type, int level, unique_ptr< IOBuf > buf)
constexpr auto size(C const &c) -> decltype(c.size())
constexpr auto empty(C const &c) -> decltype(c.empty())
GuardImpl guard(ErrorHandler &&handler)
TEST_F(AsyncSSLSocketWriteTest, write_coalescing1)
void verify(ZlibCompressionType type, std::unique_ptr< IOBuf > original, std::unique_ptr< IOBuf > compressed)
FOLLY_NODISCARD detail::ScopeGuardImplDecay< F, true > makeGuard(F &&f) noexcept(noexcept(detail::ScopeGuardImplDecay< F, true >(static_cast< F && >(f))))
#define ASSERT_NO_FATAL_FAILURE(statement)
#define ASSERT_FALSE(condition)
#define ASSERT_TRUE(condition)
constexpr detail::First first