MySQL 9.6.0
Source Code Documentation
legacy_glue.h
Go to the documentation of this file.
1// Copyright (c) 2025, 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_GTIDS_LEGACY_GLUE_H
25#define MYSQL_GTIDS_LEGACY_GLUE_H
26
27/// @file
28/// Experimental API header
29
30#include "mysql/gtid/gtid.h" // Gtid (old)
31#include "mysql/gtid/tag.h" // Tag (old)
32#include "mysql/gtid/tsid.h" // Tsid (old)
33#include "mysql/gtid/uuid.h" // Uuid (old)
34#include "mysql/gtids/gtid.h" // Gtid (new)
35#include "mysql/gtids/tag.h" // Tag (new)
36#include "mysql/gtids/tsid.h" // Tsid (new)
37#include "mysql/utils/return_status.h" // Return_status
38#include "mysql/uuids/uuid.h" // Uuid (new)
39
40/// @addtogroup GroupLibsMysqlGtids
41/// @{
42
43namespace mysql::gtids {
44
45/// Copy the legacy Uuid into mysql::uuids::Uuid.
46inline void old_to_new(const mysql::gtid::Uuid &old_uuid,
47 mysql::uuids::Uuid &new_uuid) {
48 old_uuid.copy_to(new_uuid.udata());
49}
50
51/// Copy the legacy Tag into mysql::gtids::Tag.
52inline void old_to_new(const mysql::gtid::Tag &old_tag,
53 mysql::gtids::Tag &new_tag) {
54 [[maybe_unused]] auto ret = new_tag.assign(old_tag.get_data());
56}
57
58/// Copy the legacy Tsid into mysql::gtids::Tsid.
59inline void old_to_new(const mysql::gtid::Tsid &old_tsid,
60 mysql::gtids::Tsid &new_tsid) {
61 old_to_new(old_tsid.get_uuid(), new_tsid.uuid());
62 old_to_new(old_tsid.get_tag(), new_tsid.tag());
63}
64
65/// Copy the legacy Gtid into mysql::gtids::Gtid.
66inline void old_to_new(const mysql::gtid::Gtid &old_gtid,
67 mysql::gtids::Gtid &new_gtid) {
68 old_to_new(old_gtid.get_tsid(), new_gtid.tsid());
69}
70
71} // namespace mysql::gtids
72
73// addtogroup GroupLibsMysqlGtids
74/// @}
75
76#endif // ifndef MYSQL_GTIDS_LEGACY_GLUE_H
Represents a MySQL Global Transaction Identifier.
Definition: gtid.h:47
virtual const Tsid & get_tsid() const
Get the tsid of this transaction identifier.
Definition: gtid.cpp:41
Representation of the GTID tag.
Definition: tag.h:49
const Tag_data & get_data() const
Internal data accessor.
Definition: tag.h:173
Represents Transaction Source Identifier which is composed of source UUID and transaction tag.
Definition: tsid.h:44
const Tag & get_tag() const
Tag accessor.
Definition: tsid.h:108
const Uuid & get_uuid() const
UUID accessor.
Definition: tsid.h:120
Represents a single Gtid, consisting of a Tsid and a Sequence_number.
Definition: gtid.h:189
Class representing a tag by storing the characters in a member array.
Definition: tag.h:353
Definition: tsid.h:90
const auto & tsid() const
Return const reference to the Tsid.
Definition: gtid.h:102
auto assign(const Is_tag auto &other)
Copy from the given tag into this tag.
Definition: tag.h:222
const auto & tag() const
Definition: tsid.h:75
const mysql::uuids::Uuid & uuid() const
Definition: tsid.h:72
auto * udata()
Return the data buffer as unsigned char *.
Definition: buffer_interface.h:128
Holds data for a UUID.
Definition: uuid.h:49
Experimental API header.
Experimental API header.
Experimental API header.
Definition: gtid.h:45
void old_to_new(const mysql::gtid::Uuid &old_uuid, mysql::uuids::Uuid &new_uuid)
Copy the legacy Uuid into mysql::uuids::Uuid.
Definition: legacy_glue.h:46
@ ok
operation succeeded
Experimental API header.
Uuid is a trivial and of standard layout The structure contains the following components.
Definition: uuid.h:64
void copy_to(unsigned char *data) const
Copies the given UUID object to this UUID.
Definition: uuid.h:73
Experimental API header.