MySQL 8.3.0
Source Code Documentation
abstract_crawler.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2015, 2023, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is also distributed with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23*/
24
25#ifndef ABSTRACT_CRAWLER_INCLUDED
26#define ABSTRACT_CRAWLER_INCLUDED
27
28#include <atomic>
29#include <functional>
30
36#include "my_inttypes.h"
37
38namespace Mysql {
39namespace Tools {
40namespace Dump {
41
43 public virtual I_crawler {
44 public:
45 /**
46 Adds new Chain Maker to ask for chains for found objects.
47 */
48 void register_chain_maker(I_chain_maker *new_chain_maker) override;
49
50 // Fix "inherits ... via dominance" warnings
52 I_progress_watcher *new_progress_watcher) override {
54 }
55
56 // Fix "inherits ... via dominance" warnings
57 uint64 get_id() const override { return Abstract_chain_element::get_id(); }
58
59 ~Abstract_crawler() override;
60
61 protected:
62 Abstract_crawler(std::function<bool(const Mysql::Tools::Base::Message_data &)>
63 *message_handler,
64 Simple_id_generator *object_id_generator,
66 /**
67 Routine for performing common work on each enumerated DB object.
68 */
69 void process_dump_task(I_dump_task *new_dump_task);
70
72
73 bool need_callbacks_in_child() override;
74
75 // Fix "inherits ... via dominance" warnings
77 Item_processing_data *item_processed) override {
79 }
80
82
83 private:
84 std::vector<I_chain_maker *> m_chain_makers;
85 std::vector<I_dump_task *> m_dump_tasks_created;
86 /**
87 Stores next chain ID to be used. Used as ID generator.
88 */
89 static std::atomic<uint64_t> next_chain_id;
91};
92
93} // namespace Dump
94} // namespace Tools
95} // namespace Mysql
96
97#endif
Base class for all MySQL client tools.
Definition: abstract_program.h:46
Structure to represent message from server sent after executing query.
Definition: message_data.h:48
Definition: abstract_chain_element.h:44
void register_progress_watcher(I_progress_watcher *new_progress_watcher) override
Add new Progress Watcher to report to.
Definition: abstract_chain_element.h:57
uint64 get_id() const override
Returns an application unique ID of this chain element object.
Definition: abstract_chain_element.cc:35
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.
Definition: abstract_chain_element.cc:149
Definition: abstract_crawler.h:43
void wait_for_tasks_completion()
Definition: abstract_crawler.cc:94
std::vector< I_chain_maker * > m_chain_makers
Definition: abstract_crawler.h:84
Abstract_crawler(std::function< bool(const Mysql::Tools::Base::Message_data &)> *message_handler, Simple_id_generator *object_id_generator, Mysql::Tools::Base::Abstract_program *program)
Definition: abstract_crawler.cc:39
~Abstract_crawler() override
Definition: abstract_crawler.cc:47
void process_dump_task(I_dump_task *new_dump_task)
Routine for performing common work on each enumerated DB object.
Definition: abstract_crawler.cc:62
static std::atomic< uint64_t > next_chain_id
Stores next chain ID to be used.
Definition: abstract_crawler.h:89
bool need_callbacks_in_child() override
Definition: abstract_crawler.cc:110
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.
Definition: abstract_crawler.h:76
uint64 get_id() const override
Returns an application unique ID of this chain element object.
Definition: abstract_crawler.h:57
void register_progress_watcher(I_progress_watcher *new_progress_watcher) override
Add new Progress Watcher to report to.
Definition: abstract_crawler.h:51
Mysql::Tools::Base::Abstract_program * m_program
Definition: abstract_crawler.h:90
Mysql::Tools::Base::Abstract_program * get_program()
Definition: abstract_crawler.cc:58
std::vector< I_dump_task * > m_dump_tasks_created
Definition: abstract_crawler.h:85
void register_chain_maker(I_chain_maker *new_chain_maker) override
Adds new Chain Maker to ask for chains for found objects.
Definition: abstract_crawler.cc:54
Definition: i_chain_maker.h:37
Definition: i_crawler.h:35
Interface for all individual dump process tasks.
Definition: i_dump_task.h:37
Definition: i_progress_watcher.h:36
Data structure for objects that are processed in any chain.
Definition: item_processing_data.h:42
Definition: simple_id_generator.h:36
Some integer typedefs for easier portability.
uint64_t uint64
Definition: my_inttypes.h:68
Definition: abstract_connection_program.h:39