![]() |
MySQL 8.0.43
Source Code Documentation
|
Compressor class that uses the ZSTD library. More...
#include <zstd_comp.h>
Public Types | |
| using | Compression_level_t = int |
| using | Char_t = Managed_buffer_sequence_t::Char_t |
| using | Managed_buffer_sequence_t = mysqlns::buffer::Managed_buffer_sequence<> |
| using | Size_t = Managed_buffer_sequence_t::Size_t |
Public Types inherited from binary_log::transaction::compression::Compressor | |
| using | Managed_buffer_sequence_t = mysqlns::buffer::Managed_buffer_sequence<> |
| using | Char_t = Managed_buffer_sequence_t::Char_t |
| using | Size_t = Managed_buffer_sequence_t::Size_t |
| using | Grow_constraint_t = mysqlns::buffer::Grow_constraint |
Public Member Functions | |
| Zstd_comp ()=default | |
| ~Zstd_comp () override | |
| Zstd_comp (const Zstd_comp &)=delete | |
| Zstd_comp (const Zstd_comp &&)=delete | |
| Zstd_comp & | operator= (const Zstd_comp &rhs)=delete |
| Zstd_comp & | operator= (const Zstd_comp &&rhs)=delete |
| void | set_compression_level (Compression_level_t compression_level) |
| Set the compression level for this compressor. More... | |
Public Member Functions inherited from binary_log::transaction::compression::Compressor | |
| Compressor ()=default | |
| Compressor (const Compressor &other)=delete | |
| Compressor (Compressor &&other)=delete | |
| Compressor & | operator= (const Compressor &other)=delete |
| Compressor & | operator= (Compressor &&other)=delete |
| virtual | ~Compressor ()=default |
| type | get_type_code () const |
| void | reset () |
| Reset the frame. More... | |
| template<class Input_char_t > | |
| void | feed (const Input_char_t *input_data, Size_t input_size) |
| Submit data to be compressed. More... | |
| Compress_status | compress (Managed_buffer_sequence_t &out) |
| Consume all input previously given in the feed function. More... | |
| Compress_status | finish (Managed_buffer_sequence_t &out) |
| Consume all input, produce all output, and end the frame. More... | |
| Grow_constraint_t | get_grow_constraint_hint () const |
Return a Grow_constraint that may be used with the Managed_buffer_sequence storing the output, in order to optimize memory usage for a particular compression algorithm. More... | |
| void | set_pledged_input_size (Size_t size) |
| Declare that the input size will be exactly as given. More... | |
| Size_t | get_pledged_input_size () const |
Return the size previously provided to set_pledged_input_size, or pledged_input_size_unset if no pledged size has been set. More... | |
Static Public Attributes | |
| static constexpr type | type_code = ZSTD |
| static constexpr Compression_level_t | default_compression_level = 3 |
| The default compression level for this compressor. More... | |
Static Public Attributes inherited from binary_log::transaction::compression::Compressor | |
| static constexpr Size_t | pledged_input_size_unset |
Private Member Functions | |
| type | do_get_type_code () const override |
| void | do_reset () override |
Implement reset. More... | |
| void | do_feed (const Char_t *input_data, Size_t input_size) override |
Implement feed. More... | |
| Compress_status | do_compress (Managed_buffer_sequence_t &out) override |
Implement compress. More... | |
| Compress_status | do_finish (Managed_buffer_sequence_t &out) override |
Implement finish. More... | |
| Grow_constraint_t | do_get_grow_constraint_hint () const override |
Implement get_grow_constraint_hint. More... | |
| void | destroy () |
| Deallocate the ZSTD compression context. More... | |
| void | reset_compressor () |
| Reset just the ZSTD compressor state, not other state. More... | |
| Compress_status | get_obuf (Managed_buffer_sequence_t &managed_buffer_sequence, ZSTD_outBuffer_s &obuf) |
| Make the ZSTD buffer point to the next available buffer; allocate one if necessary. More... | |
| void | move_position (Managed_buffer_sequence_t &managed_buffer_sequence, Size_t delta) |
| Account for having written to the output buffer. More... | |
Private Attributes | |
| ZSTD_CStream * | m_ctx {nullptr} |
| The ZSTD compression context. More... | |
| ZSTD_inBuffer | m_ibuf {nullptr, 0, 0} |
| The input buffer. More... | |
| bool | m_started {false} |
True when compress has been called and neither finish nor reset has yet been called. More... | |
| Compression_level_t | m_current_compression_level |
Compression level that was set in the m_ctx object. More... | |
| Compression_level_t | m_next_compression_level {default_compression_level} |
Compression level that was given in set_compression_level. More... | |
Static Private Attributes | |
| static constexpr Compression_level_t | uninitialized_compression_level {0} |
| Value used to indicate that no compression level has been specified. More... | |
Compressor class that uses the ZSTD library.
| using binary_log::transaction::compression::Compressor::Char_t = Managed_buffer_sequence_t::Char_t |
| using binary_log::transaction::compression::Compressor::Managed_buffer_sequence_t = mysqlns::buffer::Managed_buffer_sequence<> |
| using binary_log::transaction::compression::Compressor::Size_t = Managed_buffer_sequence_t::Size_t |
|
default |
|
override |
|
delete |
|
delete |
|
private |
Deallocate the ZSTD compression context.
|
overrideprivatevirtual |
Implement compress.
This differs from compress in that it does not have to reset the frame when returning out_of_memory; the caller does that.
Implements binary_log::transaction::compression::Compressor.
|
overrideprivatevirtual |
Implement feed.
This differs from feed in that it does not have to reset the frame when returning out_of_memory; the caller does that.
Implements binary_log::transaction::compression::Compressor.
|
overrideprivatevirtual |
Implement finish.
This differs from finish in that it does not have to reset the frame when returning out_of_memory; the caller does that.
Implementations may assume that compress has been called, since finish does that.
Implements binary_log::transaction::compression::Compressor.
|
overrideprivatevirtual |
Implement get_grow_constraint_hint.
In this base class, the function returns a default-constructed Grow_constraint, i.e., one which does not limit the Grow_calculator.
Reimplemented from binary_log::transaction::compression::Compressor.
|
overrideprivatevirtual |
Implements binary_log::transaction::compression::Compressor.
|
overrideprivatevirtual |
Implement reset.
Implements binary_log::transaction::compression::Compressor.
|
private |
Make the ZSTD buffer point to the next available buffer; allocate one if necessary.
| [in,out] | managed_buffer_sequence | owns the data and manages the growth. |
| [out] | obuf | ZSTD buffer that will be altered to point to the next available byte in buffer_sequence. |
| success | managed_buffer_sequence was not full, or its capacity has been incremented successfully. obuf has been set to point to next available byte. |
| out_of_memory | buffer_sequence was full and an out of memory error occurred. buffer_sequence has not been modified. |
| exceeds_max_size | buffer_sequence was full and at its max capacity. buffer_sequence has not been modified. |
|
private |
Account for having written to the output buffer.
This moves the read/write boundary in the Managed_buffer_sequence, and also increments m_total_output_size.
| managed_buffer_sequence | The buffer sequence that has been written to. |
| delta | The number of bytes that have been written. |
|
delete |
|
delete |
|
private |
Reset just the ZSTD compressor state, not other state.
| void binary_log::transaction::compression::Zstd_comp::set_compression_level | ( | Compression_level_t | compression_level | ) |
Set the compression level for this compressor.
This function may be invoked at any time, but will only take effect the next time a new frame starts, i.e., at the first call to feed after the frame has been reset.
| compression_level | the new compression level. |
|
staticconstexpr |
The default compression level for this compressor.
|
private |
The ZSTD compression context.
|
private |
Compression level that was set in the m_ctx object.
|
private |
The input buffer.
|
private |
Compression level that was given in set_compression_level.
|
private |
True when compress has been called and neither finish nor reset has yet been called.
|
staticconstexprprivate |
Value used to indicate that no compression level has been specified.