24#ifndef MYSQL_GTIDS_STRCONV_GTID_TEXT_FORMAT_CONV_H
25#define MYSQL_GTIDS_STRCONV_GTID_TEXT_FORMAT_CONV_H
48 target.write(
format, tag.string_view());
55 if (!opt_len.has_value() || *opt_len == 0) {
65 [[maybe_unused]]
auto ret =
75 target.write(
format, tsid.uuid());
98 target.concat(
format, gtid.tsid(),
100 gtid.get_sequence_number());
111 .read(sequence_number)
112 .check_prev_token([&] {
113 if (gtid.set_sequence_number(sequence_number) !=
115 parser.set_parse_error(
"GTID sequence number out of range");
124 std::optional<mysql::uuids::Uuid> last_uuid{};
125 for (
const auto &[tsid, interval_set] : gtid_set) {
126 bool first = !last_uuid.has_value();
127 assert(first || *last_uuid != tsid.uuid() || tsid.tag());
128 if (first || *last_uuid != tsid.uuid()) {
131 target.write(
format, tsid.uuid());
136 target.write(
format, tsid.tag());
139 target.write(
format, interval_set);
140 last_uuid = tsid.uuid();
144template <mysql::gt
ids::Is_gt
id_set Gt
id_set_t>
146 Gtid_set_t >id_set) {
147 using Interval_set_t =
typename Gtid_set_t::Mapped_t;
151 Interval_set_t interval_set(gtid_set.get_memory_resource());
154 auto parse_sep = [&] {
159 auto parse_interval_set = [&] {
162 .check_prev_token([&] {
163 if (gtid_set.inplace_union(tsid, std::move(interval_set)) !=
175 interval_set.clear();
180 auto parse_tag_and_interval_set = [&] {
189 .call(parse_interval_set);
193 auto parse_uuid_and_tags_and_interval_sets = [&] {
198 .call_any(parse_tag_and_interval_set);
204 fluent.call_repeated_with_separators(
205 parse_uuid_and_tags_and_interval_sets,
const auto & tag() const
Definition: tsid.h:75
const mysql::uuids::Uuid & uuid() const
Definition: tsid.h:72
Object used to parse strings.
Definition: parser.h:69
Return_status_t read(const Is_parse_options auto &opt, Object_t &obj)
Parse into the given object.
Definition: parser.h:225
Fluent_parser< Format_t > fluent(const Format_t &format)
Definition: parser.h:454
void set_parse_error(const std::string_view &message)
Store a result representing that the requested object could not be parsed because the string is wrong...
Definition: parser.h:94
std::string_view remaining_str() const
Return a string_view over the remaining string.
Definition: parse_position.h:162
static Repeat_optional any()
Return a Repeat_optional object representing any number of repetitions from 0 and up (bounded only by...
Definition: repeat.h:64
True for all Gtid set types.
Definition: gtid_set.h:178
True if Test is one of the tag classes.
Definition: tag.h:192
Concept that holds for String_counter and String_writer.
Definition: string_target.h:111
uint64_t Sequence_number
The type of the sequence number component of a GTID.
Definition: sequence_number.h:39
constexpr Sequence_number sequence_number_min
The smallest allowed value for a GTID sequence number.
Definition: sequence_number.h:50
Definition: gtid_binary_format.h:41
void skip_whitespace(Parser &parser)
Move the position forward until end or non-whitespace.
Definition: whitespace.h:47
void decode_impl(const Gtid_binary_format &format, Parser &parser, mysql::gtids::Is_tag auto &tag)
Definition: gtid_binary_format_conv.h:63
void encode_impl(const Gtid_binary_format &format, Is_string_target auto &target, const mysql::gtids::Is_tag auto &tag)
Definition: gtid_binary_format_conv.h:48
Return_t void_to_ok(const Func_t &func, Args_t &&...args)
Helper that calls the given function and returns its result, or returns Return_status::ok if the func...
Definition: return_status.h:113
static mysql_service_status_t clear(reference_caching_channel channel) noexcept
Definition: component.cc:146
Definition: gtid_text_format.h:44
static constexpr std::string_view m_uuid_uuid_separator
Definition: gtid_text_format.h:47
static constexpr std::string_view m_uuid_uuid_separator_for_output
Definition: gtid_text_format.h:52
static constexpr std::string_view m_uuid_tag_number_separator_for_output
Definition: gtid_text_format.h:61
static constexpr std::string_view m_uuid_tag_number_separator
Definition: gtid_text_format.h:56