MySQL 8.3.0
Source Code Documentation
tsid_plain.h
Go to the documentation of this file.
1// Copyright (c) 2023, 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 also distributed 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 included with MySQL.
13//
14// This program is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17// GNU General Public License, version 2.0, for more details.
18//
19// You should have received a copy of the GNU General Public License
20// along with this program; if not, write to the Free Software
21// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
23#ifndef MYSQL_GTID_TSID_PLAIN_H
24#define MYSQL_GTID_TSID_PLAIN_H
25
27#include "mysql/gtid/tsid.h"
28#include "mysql/gtid/uuid.h"
29
30/// @addtogroup GroupLibsMysqlGtid
31/// @{
32
33namespace mysql::gtid {
34
35class Tsid;
36
37/// @brief TSID representation so that:
38/// - Tsid_plain is trivial
39/// - Tsid_plain is a standard layout type
40struct Tsid_plain {
41 /// @brief Default ctor
42 Tsid_plain() = default;
43 /// @brief Construct from tsid object
44 /// @param tsid tsid to copy
45 explicit Tsid_plain(const Tsid &tsid);
46
47 /// @brief Clear this TSID
48 void clear();
49
50 /// @brief Copies internal tsid into a given buffer
51 /// @param[out] out Buffer, needs to be pre-allocated
52 /// @return Number of bytes written into the buffer
53 std::size_t to_string(char *out) const;
54
55 friend class Tsid;
56
57 private:
58 Uuid m_uuid; ///< GTID UUID
59 Tag_plain m_tag; ///< GTID Tag
60};
61
62static_assert(std::is_trivial_v<Uuid>);
63static_assert(std::is_standard_layout_v<Uuid>);
64
65} // namespace mysql::gtid
66
67/// @}
68
69#endif // MYSQL_GTID_TSID_PLAIN_H
Represents Transaction Source Identifier which is composed of source UUID and transaction tag.
Definition: tsid.h:46
Definition: global.h:34
Tag representation so that:
Definition: tag_plain.h:47
TSID representation so that:
Definition: tsid_plain.h:40
Tag_plain m_tag
GTID Tag.
Definition: tsid_plain.h:59
Uuid m_uuid
GTID UUID.
Definition: tsid_plain.h:58
void clear()
Clear this TSID.
Definition: tsid_plain.cpp:33
std::size_t to_string(char *out) const
Copies internal tsid into a given buffer.
Definition: tsid_plain.cpp:38
Tsid_plain()=default
Default ctor.
Uuid is a trivial and of standard layout The structure contains the following components.
Definition: uuid.h:63