MCPcopy Create free account
hub / github.com/ceph/ceph / compress

Method compress

src/msg/async/compression_onwire.cc:29–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29std::optional<ceph::bufferlist> TxHandler::compress(const ceph::bufferlist &input)
30{
31 if (m_init_onwire_size < m_min_size) {
32 ldout(m_cct, 20) << __func__
33 << " discovered frame that is smaller than threshold, aborting compression"
34 << dendl;
35 return {};
36 }
37
38 m_compress_potential -= input.length();
39
40 ceph::bufferlist out;
41 if (input.length() == 0) {
42 ldout(m_cct, 20) << __func__
43 << " discovered an empty segment, skipping compression without aborting"
44 << dendl;
45 out.clear();
46 return out;
47 }
48
49 std::optional<int32_t> compressor_message;
50 if (m_compressor->compress(input, out, compressor_message)) {
51 return {};
52 } else {
53 ldout(m_cct, 20) << __func__ << " uncompressed.length()=" << input.length()
54 << " compressed.length()=" << out.length() << dendl;
55 m_onwire_size += out.length();
56 return out;
57 }
58}
59
60std::optional<ceph::bufferlist> RxHandler::decompress(const ceph::bufferlist &input)
61{

Callers 1

asm_compressMethod · 0.45

Calls 2

lengthMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected