MySQL 9.6.0
Source Code Documentation
sequence_number.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_SEQUENCE_NUMBER_H
25#define MYSQL_GTIDS_SEQUENCE_NUMBER_H
26
27/// @file
28/// Experimental API header
29
30#include <cstdint> // int64_t
31#include <limits> // numeric_limits
32
33/// @addtogroup GroupLibsMysqlGtids
34/// @{
35
36namespace mysql::gtids {
37
38/// The type of the sequence number component of a GTID.
39using Sequence_number = uint64_t;
40
41/// One plus the largest allowed value for a GTID sequence number.
44
45/// The largest allowed value for a GTID sequence number.
48
49/// The smallest allowed value for a GTID sequence number.
51
52/// Return true if the given Sequence_number is in the allowed range.
53constexpr bool is_valid_sequence_number(Sequence_number sequence_number) {
54 return sequence_number >= sequence_number_min &&
55 sequence_number <= sequence_number_max_inclusive;
56}
57
58} // namespace mysql::gtids
59
60// addtogroup GroupLibsMysqlGtids
61/// @}
62
63#endif // ifndef MYSQL_GTIDS_SEQUENCE_NUMBER_H
ValueType max(X &&first)
Definition: gtid.h:103
Definition: gtid.h:45
uint64_t Sequence_number
The type of the sequence number component of a GTID.
Definition: sequence_number.h:39
constexpr bool is_valid_sequence_number(Sequence_number sequence_number)
Return true if the given Sequence_number is in the allowed range.
Definition: sequence_number.h:53
constexpr Sequence_number sequence_number_max_inclusive
The largest allowed value for a GTID sequence number.
Definition: sequence_number.h:46
constexpr Sequence_number sequence_number_max_exclusive
One plus the largest allowed value for a GTID sequence number.
Definition: sequence_number.h:42
constexpr Sequence_number sequence_number_min
The smallest allowed value for a GTID sequence number.
Definition: sequence_number.h:50