MySQL 9.0.0
Source Code Documentation
tsid_plain.h
Go to the documentation of this file.
1// Copyright (c) 2023, 2024, 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_GTID_TSID_PLAIN_H
25#define MYSQL_GTID_TSID_PLAIN_H
26
28#include "mysql/gtid/tsid.h"
29#include "mysql/gtid/uuid.h"
30
31/// @addtogroup GroupLibsMysqlGtid
32/// @{
33
34namespace mysql::gtid {
35
36class Tsid;
37
38/// @brief TSID representation so that:
39/// - Tsid_plain is trivial
40/// - Tsid_plain is a standard layout type
41struct Tsid_plain {
42 /// @brief Default ctor
43 Tsid_plain() = default;
44 /// @brief Construct from tsid object
45 /// @param tsid tsid to copy
46 explicit Tsid_plain(const Tsid &tsid);
47
48 /// @brief Clear this TSID
49 void clear();
50
51 /// @brief Copies internal tsid into a given buffer
52 /// @param[out] out Buffer, needs to be pre-allocated
53 /// @return Number of bytes written into the buffer
54 std::size_t to_string(char *out) const;
55
56 friend class Tsid;
57
58 private:
59 Uuid m_uuid; ///< GTID UUID
60 Tag_plain m_tag; ///< GTID Tag
61};
62
63static_assert(std::is_trivial_v<Uuid>);
64static_assert(std::is_standard_layout_v<Uuid>);
65
66} // namespace mysql::gtid
67
68/// @}
69
70#endif // MYSQL_GTID_TSID_PLAIN_H
Represents Transaction Source Identifier which is composed of source UUID and transaction tag.
Definition: tsid.h:47
Definition: global.h:35
Tag representation so that:
Definition: tag_plain.h:48
TSID representation so that:
Definition: tsid_plain.h:41
Tag_plain m_tag
GTID Tag.
Definition: tsid_plain.h:60
Uuid m_uuid
GTID UUID.
Definition: tsid_plain.h:59
void clear()
Clear this TSID.
Definition: tsid_plain.cpp:34
std::size_t to_string(char *out) const
Copies internal tsid into a given buffer.
Definition: tsid_plain.cpp:39
Tsid_plain()=default
Default ctor.
Uuid is a trivial and of standard layout The structure contains the following components.
Definition: uuid.h:64