MySQL 26.7.0
Source Code Documentation
transaction_provider.h
Go to the documentation of this file.
1// Copyright (c) 2026, Oracle and/or its affiliates.
2//
3// This program is free software; you can redistribute it and/or modify
4// it under the terms of the GNU General Public License, version 2.0,
5// as published by the Free Software Foundation.
6//
7// This program is designed to work with certain software (including
8// but not limited to OpenSSL) that is licensed under separate terms,
9// as designated in a particular file or component or in included license
10// documentation. The authors of MySQL hereby grant you an additional
11// permission to link the program and your derivative works with the
12// separately licensed software that they have either included with
13// the program or referenced in the documentation.
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#ifndef MYSQL_CSA_CORE_TRANSACTION_PROVIDER_H
25#define MYSQL_CSA_CORE_TRANSACTION_PROVIDER_H
26
27#include <memory>
30
31namespace mysql::csa {
32
33class Transaction_provider;
34using Transaction_provider_sptr = std::shared_ptr<Transaction_provider>;
35
36/// Interface for all transaction providers.
37/// Transaction provider shall implement the following methods:
38/// - start - start provider in case this provider is asynchronous
39/// - stop - stops provider and wakes blocking reads
40/// - finish - completes provider shutdown from the provider owner thread
41/// - is_stopped - checks if stop has been requested internally or externally
42/// - next - blocks until next transaction is fetched or provider reaches
43/// stop conditions (is_stopped will return true) or temporarily
44/// wakes up thread requesting the next transaction
46 public:
47 // using Common_reader_type = Reader_relaylog;
49 /// Get the next job
50 /// @return Job smart pointer
51 virtual Job_ptr next() = 0;
52 /// Checks whether provider has been stopped externally or internally
53 /// @brief True if stopped, false otherwise
54 virtual bool is_stopped() const = 0;
55 /// Start provider (if asynchronous)
56 virtual void start() = 0;
57 /// Stop provider and wake blocked reader calls.
58 virtual void stop() = 0;
59 /// Complete provider shutdown from the owner thread (transaction receiver).
60 /// Requires stop to have been called first; otherwise it is a no-op.
61 virtual void finish() = 0;
62 /// @brief Check if provider has an error
63 /// @return True in case an error occurred, false otherwise
64 virtual bool is_error() const = 0;
65 /// Destructor
66 virtual ~Transaction_provider() = default;
67};
68
69} // namespace mysql::csa
70
71#endif // MYSQL_CSA_CORE_TRANSACTION_PROVIDER_H
A job represents a single unit of work applied by worker pool threads.
Definition: job.h:47
Iterates over relay log and returns fetchable Jobs This reader reads consecutive events from the rela...
Definition: relay_log_adaptive_reader.h:55
Interface for all transaction providers.
Definition: transaction_provider.h:45
virtual bool is_error() const =0
Check if provider has an error.
virtual bool is_stopped() const =0
Checks whether provider has been stopped externally or internally.
virtual void stop()=0
Stop provider and wake blocked reader calls.
virtual void start()=0
Start provider (if asynchronous)
virtual void finish()=0
Complete provider shutdown from the owner thread (transaction receiver).
virtual Job_ptr next()=0
Get the next job.
virtual ~Transaction_provider()=default
Destructor.
Definition: channel.cpp:28
std::shared_ptr< Transaction_provider > Transaction_provider_sptr
Definition: transaction_provider.h:34