MySQL 8.0.39
Source Code Documentation
Mysql::Tools::Dump::Compression_lz4_writer Class Reference

Wrapper to another Output Writer, compresses formatted data stream with LZ4. More...

#include <compression_lz4_writer.h>

Inheritance diagram for Mysql::Tools::Dump::Compression_lz4_writer:
[legend]

Public Member Functions

 Compression_lz4_writer (std::function< bool(const Mysql::Tools::Base::Message_data &)> *message_handler, Simple_id_generator *object_id_generator)
 
 ~Compression_lz4_writer () override
 
bool init () override
 Initialize writer. More...
 
void append (const std::string &data_to_append) override
 Adds new block of data atomically to output. More...
 
void register_progress_watcher (I_progress_watcher *new_progress_watcher) override
 Add new Progress Watcher to report to. More...
 
uint64 get_id () const override
 Returns an application unique ID of this chain element object. More...
 
- Public Member Functions inherited from Mysql::Tools::Dump::I_chain_element
 ~I_chain_element () override
 
- Public Member Functions inherited from Mysql::Tools::Dump::I_progress_reporter
virtual ~I_progress_reporter ()
 
- Public Member Functions inherited from Mysql::Tools::Dump::Abstract_output_writer_wrapper
void register_output_writer (I_output_writer *new_output_writter) override
 Add new Output Writer to supply formatted strings to. More...
 
- Public Member Functions inherited from Mysql::Tools::Dump::Abstract_chain_element
Abstract_chain_elementoperator= (Abstract_chain_element &&other)=delete
 Disable move assignment to avoid Wvirtual-move-assign warning. More...
 
- Public Member Functions inherited from Mysql::Tools::Dump::I_output_writer_wrapper
virtual ~I_output_writer_wrapper ()=default
 

Protected Member Functions

void item_completion_in_child_callback (Item_processing_data *item_processed) override
 This callback can be requested to be called by child for any object processing. More...
 
- Protected Member Functions inherited from Mysql::Tools::Dump::Abstract_output_writer_wrapper
 Abstract_output_writer_wrapper (std::function< bool(const Mysql::Tools::Base::Message_data &)> *message_handler, Simple_id_generator *object_id_generator)
 
void append_output (const std::string &data_to_append)
 
- Protected Member Functions inherited from Mysql::Tools::Dump::Abstract_chain_element
 Abstract_chain_element (std::function< bool(const Mysql::Tools::Base::Message_data &)> *message_handler, Simple_id_generator *object_id_generator)
 
template<typename TType , typename TClass >
bool try_process_task (Item_processing_data *item_to_process, void(TClass::*processing_func)(TType *, Item_processing_data *))
 Process task object with specified function if that task object can be casted to type TType. More...
 
template<typename TType , typename TClass >
bool try_process_task (Item_processing_data *item_to_process, void(TClass::*processing_func)(TType *))
 Process task object with specified function if that task object can be casted to type TType. More...
 
void object_processing_starts (Item_processing_data *item_to_process)
 
Item_processing_dataobject_to_be_processed_in_child (Item_processing_data *current_item_data, I_chain_element *child_chain_element)
 
Item_processing_datanew_task_created (I_dump_task *dump_task_created)
 
Item_processing_datanew_chain_created (Chain_data *new_chain_data, Item_processing_data *parent_processing_data, I_chain_element *child_chain_element)
 
Item_processing_datanew_chain_created (Item_processing_data *current_item_data, I_dump_task *dump_task_created)
 
void object_processing_ends (Item_processing_data *processed_item)
 
uint64 generate_new_object_id ()
 
Simple_id_generatorget_object_id_generator () const
 
void pass_message (const Mysql::Tools::Base::Message_data &message_data)
 Passes message to message callback. More...
 
std::function< bool(const Mysql::Tools::Base::Message_data &)> * get_message_handler () const
 
virtual bool need_callbacks_in_child ()
 
- Protected Member Functions inherited from Mysql::Tools::Dump::Abstract_progress_reporter
bool have_progress_watcher ()
 Specifies if have any Progress Watcher registered. More...
 
void report_new_chain_created (Item_processing_data *new_chain_creator)
 Reports new non-empty chain being created by Chain Maker or new row fetched from table by Table Reader. More...
 
void report_object_processing_started (Item_processing_data *process_data)
 Report new object(table, row or any other) was started processing by specified Object Reader, Table Reader, Formatter or Row Formatter. More...
 
void report_object_processing_ended (Item_processing_data *finished_process_data)
 Report object(table, row or any other) finished being processed. More...
 
virtual void report_crawler_completed (I_crawler *crawler)
 Reports crawler ended enumerating objects and creating chains for them. More...
 
void register_progress_watchers_in_child (I_progress_reporter *reporter)
 

Private Member Functions

void process_buffer (size_t lz4_result)
 
void prepare_buffer (size_t src_size)
 

Private Attributes

std::mutex m_lz4_mutex
 
LZ4F_compressionContext_t m_compression_context
 
std::vector< char > m_buffer
 

Detailed Description

Wrapper to another Output Writer, compresses formatted data stream with LZ4.

Constructor & Destructor Documentation

◆ Compression_lz4_writer()

Compression_lz4_writer::Compression_lz4_writer ( std::function< bool(const Mysql::Tools::Base::Message_data &)> *  message_handler,
Simple_id_generator object_id_generator 
)

◆ ~Compression_lz4_writer()

Compression_lz4_writer::~Compression_lz4_writer ( )
override

Member Function Documentation

◆ append()

void Compression_lz4_writer::append ( const std::string &  data_to_append)
overridevirtual

Adds new block of data atomically to output.

Atomicity assures that specified block of data will be added to output as one part, will not be divided or interleaved with another data.

Implements Mysql::Tools::Dump::I_output_writer.

◆ get_id()

uint64 Mysql::Tools::Dump::Compression_lz4_writer::get_id ( ) const
inlineoverridevirtual

Returns an application unique ID of this chain element object.

This helps progress watching with multiple parts of chain during all objects processing.

Reimplemented from Mysql::Tools::Dump::Abstract_chain_element.

◆ init()

bool Compression_lz4_writer::init ( )
overridevirtual

Initialize writer.

Implements Mysql::Tools::Dump::I_output_writer.

◆ item_completion_in_child_callback()

void Mysql::Tools::Dump::Compression_lz4_writer::item_completion_in_child_callback ( Item_processing_data item_processed)
inlineoverrideprotectedvirtual

This callback can be requested to be called by child for any object processing.

This will be called when the object processing has completed. Note that this function may be called from multiple threads so all implementations must be thread-safe.

Reimplemented from Mysql::Tools::Dump::Abstract_chain_element.

◆ prepare_buffer()

void Compression_lz4_writer::prepare_buffer ( size_t  src_size)
private

◆ process_buffer()

void Compression_lz4_writer::process_buffer ( size_t  lz4_result)
private

◆ register_progress_watcher()

void Mysql::Tools::Dump::Compression_lz4_writer::register_progress_watcher ( I_progress_watcher new_progress_watcher)
inlineoverridevirtual

Add new Progress Watcher to report to.

Reimplemented from Mysql::Tools::Dump::Abstract_chain_element.

Member Data Documentation

◆ m_buffer

std::vector<char> Mysql::Tools::Dump::Compression_lz4_writer::m_buffer
private

◆ m_compression_context

LZ4F_compressionContext_t Mysql::Tools::Dump::Compression_lz4_writer::m_compression_context
private

◆ m_lz4_mutex

std::mutex Mysql::Tools::Dump::Compression_lz4_writer::m_lz4_mutex
private

The documentation for this class was generated from the following files: