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
32
#include "
client/base/abstract_program.h
"
33
#include "
client/dump/abstract_chain_element.h
"
34
#include "
client/dump/i_chain_maker.h
"
35
#include "
client/dump/i_crawler.h
"
36
#include "
client/dump/i_dump_task.h
"
37
#include "
my_inttypes.h
"
38
39
namespace
Mysql
{
40
namespace
Tools {
41
namespace
Dump {
42
43
class
Abstract_crawler
:
public
Abstract_chain_element
,
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
52
void
register_progress_watcher
(
53
I_progress_watcher
*new_progress_watcher)
override
{
54
Abstract_chain_element::register_progress_watcher
(new_progress_watcher);
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,
66
Mysql::Tools::Base::Abstract_program
*program);
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
72
void
wait_for_tasks_completion
();
73
74
bool
need_callbacks_in_child
()
override
;
75
76
// Fix "inherits ... via dominance" warnings
77
void
item_completion_in_child_callback
(
78
Item_processing_data
*item_processed)
override
{
79
Abstract_chain_element::item_completion_in_child_callback
(item_processed);
80
}
81
82
Mysql::Tools::Base::Abstract_program
*
get_program
();
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
;
91
Mysql::Tools::Base::Abstract_program
*
m_program
;
92
};
93
94
}
// namespace Dump
95
}
// namespace Tools
96
}
// namespace Mysql
97
98
#endif
abstract_chain_element.h
abstract_program.h
Mysql::Tools::Base::Abstract_program
Base class for all MySQL client tools.
Definition:
abstract_program.h:47
Mysql::Tools::Base::Message_data
Structure to represent message from server sent after executing query.
Definition:
message_data.h:49
Mysql::Tools::Dump::Abstract_chain_element
Definition:
abstract_chain_element.h:45
Mysql::Tools::Dump::Abstract_chain_element::register_progress_watcher
void register_progress_watcher(I_progress_watcher *new_progress_watcher) override
Add new Progress Watcher to report to.
Definition:
abstract_chain_element.h:58
Mysql::Tools::Dump::Abstract_chain_element::get_id
uint64 get_id() const override
Returns an application unique ID of this chain element object.
Definition:
abstract_chain_element.cc:36
Mysql::Tools::Dump::Abstract_chain_element::item_completion_in_child_callback
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
Mysql::Tools::Dump::Abstract_crawler
Definition:
abstract_crawler.h:44
Mysql::Tools::Dump::Abstract_crawler::wait_for_tasks_completion
void wait_for_tasks_completion()
Definition:
abstract_crawler.cc:95
Mysql::Tools::Dump::Abstract_crawler::m_chain_makers
std::vector< I_chain_maker * > m_chain_makers
Definition:
abstract_crawler.h:85
Mysql::Tools::Dump::Abstract_crawler::Abstract_crawler
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
Mysql::Tools::Dump::Abstract_crawler::~Abstract_crawler
~Abstract_crawler() override
Definition:
abstract_crawler.cc:48
Mysql::Tools::Dump::Abstract_crawler::process_dump_task
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
Mysql::Tools::Dump::Abstract_crawler::next_chain_id
static std::atomic< uint64_t > next_chain_id
Stores next chain ID to be used.
Definition:
abstract_crawler.h:90
Mysql::Tools::Dump::Abstract_crawler::need_callbacks_in_child
bool need_callbacks_in_child() override
Definition:
abstract_crawler.cc:111
Mysql::Tools::Dump::Abstract_crawler::item_completion_in_child_callback
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
Mysql::Tools::Dump::Abstract_crawler::get_id
uint64 get_id() const override
Returns an application unique ID of this chain element object.
Definition:
abstract_crawler.h:58
Mysql::Tools::Dump::Abstract_crawler::register_progress_watcher
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::Dump::Abstract_crawler::m_program
Mysql::Tools::Base::Abstract_program * m_program
Definition:
abstract_crawler.h:91
Mysql::Tools::Dump::Abstract_crawler::get_program
Mysql::Tools::Base::Abstract_program * get_program()
Definition:
abstract_crawler.cc:59
Mysql::Tools::Dump::Abstract_crawler::m_dump_tasks_created
std::vector< I_dump_task * > m_dump_tasks_created
Definition:
abstract_crawler.h:86
Mysql::Tools::Dump::Abstract_crawler::register_chain_maker
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
Mysql::Tools::Dump::I_chain_maker
Definition:
i_chain_maker.h:38
Mysql::Tools::Dump::I_crawler
Definition:
i_crawler.h:36
Mysql::Tools::Dump::I_dump_task
Interface for all individual dump process tasks.
Definition:
i_dump_task.h:38
Mysql::Tools::Dump::I_progress_watcher
Definition:
i_progress_watcher.h:37
Mysql::Tools::Dump::Item_processing_data
Data structure for objects that are processed in any chain.
Definition:
item_processing_data.h:43
Mysql::Tools::Dump::Simple_id_generator
Definition:
simple_id_generator.h:37
i_chain_maker.h
i_crawler.h
i_dump_task.h
my_inttypes.h
Some integer typedefs for easier portability.
uint64
uint64_t uint64
Definition:
my_inttypes.h:69
Mysql
Definition:
abstract_connection_program.h:38
client
dump
abstract_crawler.h
Generated by
1.9.2