MySQL 26.7.0
Source Code Documentation
cached_event_payload.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_RELAY_LOG_CACHED_EVENT_PAYLOAD_H
25#define MYSQL_CSA_RELAY_LOG_CACHED_EVENT_PAYLOAD_H
26
27#include <memory>
28#include "sql/binlog_reader.h" // Default_binlog_event_allocator
30#include "sql/log_event.h" // Log_event
31
32namespace mysql::csa {
33
34/// @brief Implementation of the IReader_event which keeps event raw
35/// payload until decoded
37 public:
38 /// Is constructed using payload data/metadata and associated fde
39 /// @param payload Event payload data and metadata returned by the reader
40 /// @param fde Current source's fde
42 std::shared_ptr<Log_event> fde);
43
44 /// @brief Decode function, which decodes payload and returns Log event
45 /// smart pointer
46 /// @return Log event smart pointer
47 std::shared_ptr<Log_event> decode() override;
48
49 /// @brief Resets event state
50 void reset(const Format_description_log_event *) override;
51
52 private:
53 /// Event data, owning pointer returned by the reader (legacy design)
54 uint8_t *m_data;
55 /// Event length
56 std::size_t m_length;
57 /// Information on whether to verify checksum after decoding
58 bool m_verify_checksum{false};
59 /// Owning pointer of the FDE base
60 std::shared_ptr<Log_event> m_current_fde;
61 /// Non-owning pointer to FDE
63 /// @brief Allocator used to allocate event data in the reader, we use
64 /// a separate object, since 'Default_binlog_event_allocator' methods do not
65 /// use object state in any way
67};
68
69} // namespace mysql::csa
70
71#endif // MYSQL_CSA_RELAY_LOG_CACHED_EVENT_PAYLOAD_H
Definition: binlog_reader.h:82
For binlog version 4.
Definition: log_event.h:1558
Implementation of the IReader_event which keeps event raw payload until decoded.
Definition: cached_event_payload.h:36
void reset(const Format_description_log_event *) override
Resets event state.
Definition: cached_event_payload.cpp:41
Format_description_log_event * m_fde_ptr
Non-owning pointer to FDE.
Definition: cached_event_payload.h:62
std::size_t m_length
Event length.
Definition: cached_event_payload.h:56
Cached_event_payload(const Event_payload &payload, std::shared_ptr< Log_event > fde)
Is constructed using payload data/metadata and associated fde.
Definition: cached_event_payload.cpp:30
bool m_verify_checksum
Information on whether to verify checksum after decoding.
Definition: cached_event_payload.h:58
uint8_t * m_data
Event data, owning pointer returned by the reader (legacy design)
Definition: cached_event_payload.h:54
Default_binlog_event_allocator m_allocator
Allocator used to allocate event data in the reader, we use a separate object, since 'Default_binlog_...
Definition: cached_event_payload.h:66
std::shared_ptr< Log_event > decode() override
Decode function, which decodes payload and returns Log event smart pointer.
Definition: cached_event_payload.cpp:43
std::shared_ptr< Log_event > m_current_fde
Owning pointer of the FDE base.
Definition: cached_event_payload.h:60
Interface for abstract event data returned by the reader, which can be decoded into a log event using...
Definition: ireader_event.h:38
Binary log event definitions.
Definition: channel.cpp:28
Helper structure used by the reader to aggregate payload and information needed to decode an event.
Definition: binlog_reader.h:91