MySQL 26.7.0
Source Code Documentation
managed_event.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_MANAGED_EVENT_H
25#define MYSQL_CSA_MANAGED_EVENT_H
26
27#include <memory>
29#include "sql/log_event.h" // Log_event
30
31namespace mysql::csa {
32
33/// @brief Managed event. For now, it contains functionality to pass memory
34/// ownership between CSA threads.
36 public:
37 using Log_event_ptr = std::shared_ptr<Log_event>;
38 /// @brief Construct
39 Managed_event() = default;
40 /// @brief Construct from ev
41 /// @param ev Pointer to copy
42 /// @param ev_owns_memory True if ev exclusively owns log event memory
43 Managed_event(const Log_event_ptr &ev, bool ev_owns_memory);
44 /// @brief Internal event accessor
45 /// @return Reference to internal event
47 /// @brief Internal event accessor, const
48 /// @return Reference to internal event
49 const Log_event_ptr &get_event() const;
50 /// @brief Marks whether this fetched event is the last event of transaction.
51 void set_last_in_transaction(bool is_last);
52 /// @brief Returns whether this fetched event is the last event of
53 /// transaction.
54 bool is_last_in_transaction() const;
55 /// @brief Returns true if Managed_event manages an event, false otherwise
56 explicit operator bool() const noexcept;
57
58 private:
59 /// @brief Internal event pointer
61 /// @brief True if this fetched event is the transaction terminal event.
63};
64
65} // namespace mysql::csa
66
67#endif // MYSQL_CSA_MANAGED_EVENT_H
Managed event.
Definition: managed_event.h:35
bool is_last_in_transaction() const
Returns whether this fetched event is the last event of transaction.
Definition: managed_event.cpp:46
bool m_is_last_in_transaction
True if this fetched event is the transaction terminal event.
Definition: managed_event.h:62
Log_event_ptr m_event
Internal event pointer.
Definition: managed_event.h:60
Managed_event()=default
Construct.
std::shared_ptr< Log_event > Log_event_ptr
Definition: managed_event.h:37
Log_event_ptr & get_event()
Internal event accessor.
Definition: managed_event.cpp:36
void set_last_in_transaction(bool is_last)
Marks whether this fetched event is the last event of transaction.
Definition: managed_event.cpp:42
Binary log event definitions.
Definition: channel.cpp:28
noexcept
The return type for any call_and_catch(f, args...) call where f(args...) returns Type.
Definition: call_and_catch.h:76
Experimental API header.