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