24#ifndef MYSQL_BINLOG_EVENT_COMPRESSION_ZSTD_COMP_H
25#define MYSQL_BINLOG_EVENT_COMPRESSION_ZSTD_COMP_H
27#define ZSTD_STATIC_LINKING_ONLY 1
35struct ZSTD_outBuffer_s;
117 ZSTD_outBuffer_s &obuf);
Container class that provides a sequence of buffers to the caller.
Abstract base class for compressors.
Definition: compressor.h:80
Managed_buffer_sequence_t::Size_t Size_t
Definition: compressor.h:85
mysql::binlog::event::compression::buffer::Managed_buffer_sequence<> Managed_buffer_sequence_t
Definition: compressor.h:83
Managed_buffer_sequence_t::Char_t Char_t
Definition: compressor.h:84
Compressor class that uses the ZSTD library.
Definition: zstd_comp.h:40
ZSTD_inBuffer m_ibuf
The input buffer.
Definition: zstd_comp.h:136
void reset_compressor()
Reset just the ZSTD compressor state, not other state.
Definition: zstd_comp.cpp:67
Compress_status do_compress(Managed_buffer_sequence_t &out) override
Implement compress.
Definition: zstd_comp.cpp:94
bool m_started
True when compress has been called and neither finish nor reset has yet been called.
Definition: zstd_comp.h:143
static constexpr Compression_level_t default_compression_level
The default compression level for this compressor.
Definition: zstd_comp.h:50
mysql::binlog::event::resource::Memory_resource Memory_resource_t
Definition: zstd_comp.h:45
void move_position(Managed_buffer_sequence_t &managed_buffer_sequence, Size_t delta)
Account for having written to the output buffer.
Definition: zstd_comp.cpp:189
static constexpr Compression_level_t uninitialized_compression_level
Value used to indicate that no compression level has been specified.
Definition: zstd_comp.h:139
Zstd_comp & operator=(const Zstd_comp &&rhs)=delete
~Zstd_comp() override
Definition: zstd_comp.cpp:37
Compress_status do_finish(Managed_buffer_sequence_t &out) override
Implement finish.
Definition: zstd_comp.cpp:161
ZSTD_customMem m_zstd_custom_mem
ZSTD memory allocator objects and functions.
Definition: zstd_comp.h:156
Zstd_comp & operator=(const Zstd_comp &rhs)=delete
type do_get_type_code() const override
Definition: zstd_comp.cpp:47
static void * zstd_mem_res_alloc(void *opaque, size_t size)
Definition: zstd_comp.cpp:225
void set_compression_level(Compression_level_t compression_level)
Set the compression level for this compressor.
Definition: zstd_comp.cpp:49
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.
Definition: zstd_comp.cpp:194
void do_feed(const Char_t *input_data, Size_t input_size) override
Implement feed.
Definition: zstd_comp.cpp:81
void do_reset() override
Implement reset.
Definition: zstd_comp.cpp:53
Compression_level_t m_next_compression_level
Compression level that was given in set_compression_level.
Definition: zstd_comp.h:150
Compression_level_t m_current_compression_level
Compression level that was set in the m_ctx object.
Definition: zstd_comp.h:146
static constexpr type type_code
Definition: zstd_comp.h:47
int Compression_level_t
Definition: zstd_comp.h:46
Zstd_comp(const Memory_resource_t &memory_resource=Memory_resource_t())
Definition: zstd_comp.cpp:32
static void zstd_mem_res_free(void *opaque, void *address)
Definition: zstd_comp.cpp:230
Memory_resource_t m_memory_resource
Instrumented memory allocator object.
Definition: zstd_comp.h:153
Zstd_comp(const Zstd_comp &&)=delete
ZSTD_CStream * m_ctx
The ZSTD compression context.
Definition: zstd_comp.h:133
Zstd_comp(const Zstd_comp &)=delete
void destroy()
Deallocate the ZSTD compression context.
Definition: zstd_comp.cpp:39
Grow_constraint_t do_get_grow_constraint_hint() const override
Implement get_grow_constraint_hint.
Definition: zstd_comp.cpp:217
Description of a heuristic to determine how much memory to allocate.
Definition: grow_constraint.h:66
Owned, non-contiguous, growable memory buffer.
Definition: managed_buffer_sequence.h:115
Polymorphism-free memory resource class with custom allocator and deallocator functions.
Definition: memory_resource.h:88
Class that wraps resources in a polymorphic manner.
Grow_status
Error statuses for classes that use Grow_calculator.
Definition: grow_status.h:38
type
Definition: base.h:40
@ ZSTD
Definition: base.h:42
size_t size(const char *const c)
Definition: base64.h:46
#define NODISCARD
The function attribute [[NODISCARD]] is a replacement for [[nodiscard]] to workaround a gcc bug.
Definition: nodiscard.h:47