MySQL 8.0.40
Source Code Documentation
|
Wrapper to another Object Reader, adds all objects to read on queue. More...
#include <object_queue.h>
Public Member Functions | |
Object_queue (std::function< bool(const Mysql::Tools::Base::Message_data &)> *message_handler, Simple_id_generator *object_id_generator, uint threads_count, std::function< void(bool)> *thread_callback, Mysql::Tools::Base::Abstract_program *program) | |
~Object_queue () override | |
void | read_object (Item_processing_data *item_to_process) override |
Reads information on DB object related to task. 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... | |
void | stop_queue () |
Public Member Functions inherited from Mysql::Tools::Dump::Abstract_object_reader_wrapper | |
void | register_object_reader (I_object_reader *new_object_reader) override |
Add new Object Reader to supply direct execution of dump tasks to. More... | |
Public Member Functions inherited from Mysql::Tools::Dump::I_object_reader_wrapper | |
virtual | ~I_object_reader_wrapper ()=default |
Public Member Functions inherited from Mysql::Tools::Dump::Abstract_chain_element | |
Abstract_chain_element & | operator= (Abstract_chain_element &&other)=delete |
Disable move assignment to avoid Wvirtual-move-assign warning. 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 () |
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_object_reader_wrapper | |
Abstract_object_reader_wrapper (std::function< bool(const Mysql::Tools::Base::Message_data &)> *message_handler, Simple_id_generator *object_id_generator) | |
void | format_object (Item_processing_data *current_processing_data) |
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_data * | object_to_be_processed_in_child (Item_processing_data *current_item_data, I_chain_element *child_chain_element) |
Item_processing_data * | new_task_created (I_dump_task *dump_task_created) |
Item_processing_data * | new_chain_created (Chain_data *new_chain_data, Item_processing_data *parent_processing_data, I_chain_element *child_chain_element) |
Item_processing_data * | new_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_generator * | get_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 | queue_thread () |
void | task_availability_callback (const Abstract_dump_task *available_task) |
void | add_ready_items_to_queue (std::map< const I_dump_task *, std::vector< Item_processing_data * > * >::iterator it) |
Private Attributes | |
my_boost::thread_group | m_thread_group |
std::mutex | m_queue_mutex |
std::map< const I_dump_task *, std::vector< Item_processing_data * > * > | m_tasks_map |
std::queue< Item_processing_data * > | m_items_ready_for_processing |
std::function< void(const Abstract_dump_task *)> | m_task_availability_callback |
std::atomic< bool > | m_is_queue_running |
std::function< void(bool)> * | m_thread_callback |
Mysql::Tools::Base::Abstract_program * | m_program |
Wrapper to another Object Reader, adds all objects to read on queue.
Allows specified number of threads to dequeue and process objects.
Object_queue::Object_queue | ( | std::function< bool(const Mysql::Tools::Base::Message_data &)> * | message_handler, |
Simple_id_generator * | object_id_generator, | ||
uint | threads_count, | ||
std::function< void(bool)> * | thread_callback, | ||
Mysql::Tools::Base::Abstract_program * | program | ||
) |
|
override |
|
private |
|
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.
|
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.
|
private |
In case there are no items to be processed from the queue then in such a scenario the current thread will be infinitely hung in this loop without allowing context switch to happen, so that other executing threads can further progress. Thus we need this thread to sleep so that other threads can proceed to complete its execution or allow main thread to insert new items into the queue.
|
overridevirtual |
Reads information on DB object related to task.
Implements Mysql::Tools::Dump::I_object_reader.
|
inlineoverridevirtual |
Add new Progress Watcher to report to.
Reimplemented from Mysql::Tools::Dump::Abstract_chain_element.
void Object_queue::stop_queue | ( | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |