| 27 | } |
| 28 | |
| 29 | std::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 | |
| 60 | std::optional<ceph::bufferlist> RxHandler::decompress(const ceph::bufferlist &input) |
| 61 | { |
no test coverage detected