From 63729e9bd2c67eee6c50ac7b4f06fb072c816021 Mon Sep 17 00:00:00 2001 From: Yura Sorokin Date: Fri, 20 Feb 2026 20:22:55 +0100 Subject: [PATCH] PS-10246 feature: Implement fixing next_event_position fields / checksums in the event common_header / footer in case of reconnecting to another node (part 1) https://perconadev.atlassian.net/browse/PS-10246 "binsrv::event" namespace renamed to "binsrv::events". File layout, include directives, header guards and references changed accordingly. --- CMakeLists.txt | 158 +++++++++--------- src/app.cpp | 34 ++-- src/binsrv/event/code_type.hpp | 104 ------------ .../anonymous_gtid_log_body_impl.hpp | 14 +- .../anonymous_gtid_log_body_impl_fwd.hpp | 14 +- .../anonymous_gtid_log_post_header_impl.hpp | 14 +- ...nonymous_gtid_log_post_header_impl_fwd.hpp | 14 +- .../checksum_algorithm_type.hpp | 12 +- .../checksum_algorithm_type_fwd.hpp | 10 +- src/binsrv/events/code_type.hpp | 104 ++++++++++++ .../{event => events}/code_type_fwd.hpp | 10 +- .../{event => events}/common_header.cpp | 10 +- .../{event => events}/common_header.hpp | 18 +- .../common_header_flag_type.hpp | 44 ++--- .../common_header_flag_type_fwd.hpp | 10 +- .../{event => events}/common_header_fwd.hpp | 10 +- src/binsrv/{event => events}/empty_body.cpp | 6 +- src/binsrv/{event => events}/empty_body.hpp | 12 +- .../{event => events}/empty_body_fwd.hpp | 10 +- .../{event => events}/empty_post_header.cpp | 6 +- .../{event => events}/empty_post_header.hpp | 12 +- .../empty_post_header_fwd.hpp | 10 +- src/binsrv/{event => events}/event.cpp | 16 +- src/binsrv/{event => events}/event.hpp | 56 +++---- src/binsrv/{event => events}/event_fwd.hpp | 10 +- src/binsrv/{event => events}/footer.cpp | 6 +- src/binsrv/{event => events}/footer.hpp | 12 +- src/binsrv/{event => events}/footer_fwd.hpp | 10 +- .../format_description_body_impl.cpp | 10 +- .../format_description_body_impl.hpp | 14 +- .../format_description_body_impl_fwd.hpp | 14 +- .../format_description_post_header_impl.cpp | 10 +- .../format_description_post_header_impl.hpp | 14 +- ...ormat_description_post_header_impl_fwd.hpp | 14 +- src/binsrv/{event => events}/generic_body.hpp | 14 +- .../{event => events}/generic_body_fwd.hpp | 12 +- .../{event => events}/generic_post_header.hpp | 14 +- .../generic_post_header_fwd.hpp | 12 +- .../{event => events}/gtid_log_body.cpp | 6 +- .../{event => events}/gtid_log_body.hpp | 12 +- .../{event => events}/gtid_log_body_fwd.hpp | 10 +- .../{event => events}/gtid_log_body_impl.hpp | 14 +- .../gtid_log_body_impl_fwd.hpp | 14 +- .../{event => events}/gtid_log_flag_type.hpp | 30 ++-- .../gtid_log_flag_type_fwd.hpp | 10 +- .../gtid_log_post_header.cpp | 8 +- .../gtid_log_post_header.hpp | 26 +-- .../gtid_log_post_header_fwd.hpp | 10 +- .../gtid_log_post_header_impl.hpp | 14 +- .../gtid_log_post_header_impl_fwd.hpp | 14 +- .../gtid_tagged_log_body_impl.cpp | 10 +- .../gtid_tagged_log_body_impl.hpp | 14 +- .../gtid_tagged_log_body_impl_fwd.hpp | 14 +- .../gtid_tagged_log_post_header_impl.hpp | 14 +- .../gtid_tagged_log_post_header_impl_fwd.hpp | 14 +- .../previous_gtids_log_body_impl.cpp | 8 +- .../previous_gtids_log_body_impl.hpp | 12 +- .../previous_gtids_log_body_impl_fwd.hpp | 14 +- .../previous_gtids_log_post_header_impl.hpp | 14 +- ...revious_gtids_log_post_header_impl_fwd.hpp | 14 +- .../{event => events}/protocol_traits.cpp | 8 +- .../{event => events}/protocol_traits.hpp | 14 +- .../{event => events}/protocol_traits_fwd.hpp | 10 +- .../{event => events}/reader_context.cpp | 24 +-- .../{event => events}/reader_context.hpp | 18 +- .../{event => events}/reader_context_fwd.hpp | 10 +- .../{event => events}/rotate_body_impl.cpp | 8 +- .../{event => events}/rotate_body_impl.hpp | 12 +- .../rotate_body_impl_fwd.hpp | 14 +- .../rotate_post_header_impl.cpp | 8 +- .../rotate_post_header_impl.hpp | 12 +- .../rotate_post_header_impl_fwd.hpp | 14 +- .../{event => events}/stop_body_impl.hpp | 14 +- .../{event => events}/stop_body_impl_fwd.hpp | 14 +- .../stop_post_header_impl.hpp | 14 +- .../stop_post_header_impl_fwd.hpp | 14 +- src/binsrv/{event => events}/unknown_body.cpp | 6 +- src/binsrv/{event => events}/unknown_body.hpp | 12 +- .../{event => events}/unknown_body_fwd.hpp | 10 +- .../{event => events}/unknown_post_header.cpp | 6 +- .../{event => events}/unknown_post_header.hpp | 14 +- .../unknown_post_header_fwd.hpp | 10 +- src/binsrv/storage.cpp | 14 +- 83 files changed, 725 insertions(+), 725 deletions(-) delete mode 100644 src/binsrv/event/code_type.hpp rename src/binsrv/{event => events}/anonymous_gtid_log_body_impl.hpp (71%) rename src/binsrv/{event => events}/anonymous_gtid_log_body_impl_fwd.hpp (71%) rename src/binsrv/{event => events}/anonymous_gtid_log_post_header_impl.hpp (69%) rename src/binsrv/{event => events}/anonymous_gtid_log_post_header_impl_fwd.hpp (69%) rename src/binsrv/{event => events}/checksum_algorithm_type.hpp (89%) rename src/binsrv/{event => events}/checksum_algorithm_type_fwd.hpp (79%) create mode 100644 src/binsrv/events/code_type.hpp rename src/binsrv/{event => events}/code_type_fwd.hpp (82%) rename src/binsrv/{event => events}/common_header.cpp (96%) rename src/binsrv/{event => events}/common_header.hpp (85%) rename src/binsrv/{event => events}/common_header_flag_type.hpp (63%) rename src/binsrv/{event => events}/common_header_flag_type_fwd.hpp (81%) rename src/binsrv/{event => events}/common_header_fwd.hpp (81%) rename src/binsrv/{event => events}/empty_body.cpp (92%) rename src/binsrv/{event => events}/empty_body.hpp (79%) rename src/binsrv/{event => events}/empty_body_fwd.hpp (82%) rename src/binsrv/{event => events}/empty_post_header.cpp (92%) rename src/binsrv/{event => events}/empty_post_header.hpp (77%) rename src/binsrv/{event => events}/empty_post_header_fwd.hpp (80%) rename src/binsrv/{event => events}/event.cpp (96%) rename src/binsrv/{event => events}/event.hpp (72%) rename src/binsrv/{event => events}/event_fwd.hpp (83%) rename src/binsrv/{event => events}/footer.cpp (95%) rename src/binsrv/{event => events}/footer.hpp (82%) rename src/binsrv/{event => events}/footer_fwd.hpp (83%) rename src/binsrv/{event => events}/format_description_body_impl.cpp (93%) rename src/binsrv/{event => events}/format_description_body_impl.hpp (81%) rename src/binsrv/{event => events}/format_description_body_impl_fwd.hpp (74%) rename src/binsrv/{event => events}/format_description_post_header_impl.cpp (96%) rename src/binsrv/{event => events}/format_description_post_header_impl.hpp (89%) rename src/binsrv/{event => events}/format_description_post_header_impl_fwd.hpp (73%) rename src/binsrv/{event => events}/generic_body.hpp (87%) rename src/binsrv/{event => events}/generic_body_fwd.hpp (77%) rename src/binsrv/{event => events}/generic_post_header.hpp (86%) rename src/binsrv/{event => events}/generic_post_header_fwd.hpp (75%) rename src/binsrv/{event => events}/gtid_log_body.cpp (98%) rename src/binsrv/{event => events}/gtid_log_body.hpp (94%) rename src/binsrv/{event => events}/gtid_log_body_fwd.hpp (81%) rename src/binsrv/{event => events}/gtid_log_body_impl.hpp (73%) rename src/binsrv/{event => events}/gtid_log_body_impl_fwd.hpp (73%) rename src/binsrv/{event => events}/gtid_log_flag_type.hpp (73%) rename src/binsrv/{event => events}/gtid_log_flag_type_fwd.hpp (82%) rename src/binsrv/{event => events}/gtid_log_post_header.cpp (97%) rename src/binsrv/{event => events}/gtid_log_post_header.hpp (80%) rename src/binsrv/{event => events}/gtid_log_post_header_fwd.hpp (80%) rename src/binsrv/{event => events}/gtid_log_post_header_impl.hpp (71%) rename src/binsrv/{event => events}/gtid_log_post_header_impl_fwd.hpp (71%) rename src/binsrv/{event => events}/gtid_tagged_log_body_impl.cpp (98%) rename src/binsrv/{event => events}/gtid_tagged_log_body_impl.hpp (94%) rename src/binsrv/{event => events}/gtid_tagged_log_body_impl_fwd.hpp (74%) rename src/binsrv/{event => events}/gtid_tagged_log_post_header_impl.hpp (70%) rename src/binsrv/{event => events}/gtid_tagged_log_post_header_impl_fwd.hpp (70%) rename src/binsrv/{event => events}/previous_gtids_log_body_impl.cpp (92%) rename src/binsrv/{event => events}/previous_gtids_log_body_impl.hpp (82%) rename src/binsrv/{event => events}/previous_gtids_log_body_impl_fwd.hpp (74%) rename src/binsrv/{event => events}/previous_gtids_log_post_header_impl.hpp (69%) rename src/binsrv/{event => events}/previous_gtids_log_post_header_impl_fwd.hpp (69%) rename src/binsrv/{event => events}/protocol_traits.cpp (96%) rename src/binsrv/{event => events}/protocol_traits.hpp (84%) rename src/binsrv/{event => events}/protocol_traits_fwd.hpp (93%) rename src/binsrv/{event => events}/reader_context.cpp (97%) rename src/binsrv/{event => events}/reader_context.hpp (91%) rename src/binsrv/{event => events}/reader_context_fwd.hpp (79%) rename src/binsrv/{event => events}/rotate_body_impl.cpp (90%) rename src/binsrv/{event => events}/rotate_body_impl.hpp (85%) rename src/binsrv/{event => events}/rotate_body_impl_fwd.hpp (76%) rename src/binsrv/{event => events}/rotate_post_header_impl.cpp (94%) rename src/binsrv/{event => events}/rotate_post_header_impl.hpp (79%) rename src/binsrv/{event => events}/rotate_post_header_impl_fwd.hpp (74%) rename src/binsrv/{event => events}/stop_body_impl.hpp (74%) rename src/binsrv/{event => events}/stop_body_impl_fwd.hpp (73%) rename src/binsrv/{event => events}/stop_post_header_impl.hpp (72%) rename src/binsrv/{event => events}/stop_post_header_impl_fwd.hpp (72%) rename src/binsrv/{event => events}/unknown_body.cpp (89%) rename src/binsrv/{event => events}/unknown_body.hpp (80%) rename src/binsrv/{event => events}/unknown_body_fwd.hpp (81%) rename src/binsrv/{event => events}/unknown_post_header.cpp (89%) rename src/binsrv/{event => events}/unknown_post_header.hpp (78%) rename src/binsrv/{event => events}/unknown_post_header_fwd.hpp (80%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e4ca52..69f3be2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,115 +86,115 @@ set(source_files src/app_version.hpp # binlog event data structure files - src/binsrv/event/anonymous_gtid_log_body_impl_fwd.hpp - src/binsrv/event/anonymous_gtid_log_body_impl.hpp + src/binsrv/events/anonymous_gtid_log_body_impl_fwd.hpp + src/binsrv/events/anonymous_gtid_log_body_impl.hpp - src/binsrv/event/anonymous_gtid_log_post_header_impl_fwd.hpp - src/binsrv/event/anonymous_gtid_log_post_header_impl.hpp + src/binsrv/events/anonymous_gtid_log_post_header_impl_fwd.hpp + src/binsrv/events/anonymous_gtid_log_post_header_impl.hpp - src/binsrv/event/checksum_algorithm_type_fwd.hpp - src/binsrv/event/checksum_algorithm_type.hpp + src/binsrv/events/checksum_algorithm_type_fwd.hpp + src/binsrv/events/checksum_algorithm_type.hpp - src/binsrv/event/code_type_fwd.hpp - src/binsrv/event/code_type.hpp + src/binsrv/events/code_type_fwd.hpp + src/binsrv/events/code_type.hpp - src/binsrv/event/common_header_fwd.hpp - src/binsrv/event/common_header.hpp - src/binsrv/event/common_header.cpp + src/binsrv/events/common_header_fwd.hpp + src/binsrv/events/common_header.hpp + src/binsrv/events/common_header.cpp - src/binsrv/event/common_header_flag_type_fwd.hpp - src/binsrv/event/common_header_flag_type.hpp + src/binsrv/events/common_header_flag_type_fwd.hpp + src/binsrv/events/common_header_flag_type.hpp - src/binsrv/event/empty_body_fwd.hpp - src/binsrv/event/empty_body.hpp - src/binsrv/event/empty_body.cpp + src/binsrv/events/empty_body_fwd.hpp + src/binsrv/events/empty_body.hpp + src/binsrv/events/empty_body.cpp - src/binsrv/event/empty_post_header_fwd.hpp - src/binsrv/event/empty_post_header.hpp - src/binsrv/event/empty_post_header.cpp + src/binsrv/events/empty_post_header_fwd.hpp + src/binsrv/events/empty_post_header.hpp + src/binsrv/events/empty_post_header.cpp - src/binsrv/event/event_fwd.hpp - src/binsrv/event/event.hpp - src/binsrv/event/event.cpp + src/binsrv/events/event_fwd.hpp + src/binsrv/events/event.hpp + src/binsrv/events/event.cpp - src/binsrv/event/footer_fwd.hpp - src/binsrv/event/footer.hpp - src/binsrv/event/footer.cpp + src/binsrv/events/footer_fwd.hpp + src/binsrv/events/footer.hpp + src/binsrv/events/footer.cpp - src/binsrv/event/format_description_body_impl_fwd.hpp - src/binsrv/event/format_description_body_impl.hpp - src/binsrv/event/format_description_body_impl.cpp + src/binsrv/events/format_description_body_impl_fwd.hpp + src/binsrv/events/format_description_body_impl.hpp + src/binsrv/events/format_description_body_impl.cpp - src/binsrv/event/format_description_post_header_impl_fwd.hpp - src/binsrv/event/format_description_post_header_impl.hpp - src/binsrv/event/format_description_post_header_impl.cpp + src/binsrv/events/format_description_post_header_impl_fwd.hpp + src/binsrv/events/format_description_post_header_impl.hpp + src/binsrv/events/format_description_post_header_impl.cpp - src/binsrv/event/generic_body_fwd.hpp - src/binsrv/event/generic_body.hpp + src/binsrv/events/generic_body_fwd.hpp + src/binsrv/events/generic_body.hpp - src/binsrv/event/generic_post_header_fwd.hpp - src/binsrv/event/generic_post_header.hpp + src/binsrv/events/generic_post_header_fwd.hpp + src/binsrv/events/generic_post_header.hpp - src/binsrv/event/gtid_log_flag_type_fwd.hpp - src/binsrv/event/gtid_log_flag_type.hpp + src/binsrv/events/gtid_log_flag_type_fwd.hpp + src/binsrv/events/gtid_log_flag_type.hpp - src/binsrv/event/gtid_log_body_fwd.hpp - src/binsrv/event/gtid_log_body.hpp - src/binsrv/event/gtid_log_body.cpp + src/binsrv/events/gtid_log_body_fwd.hpp + src/binsrv/events/gtid_log_body.hpp + src/binsrv/events/gtid_log_body.cpp - src/binsrv/event/gtid_log_body_impl_fwd.hpp - src/binsrv/event/gtid_log_body_impl.hpp + src/binsrv/events/gtid_log_body_impl_fwd.hpp + src/binsrv/events/gtid_log_body_impl.hpp - src/binsrv/event/gtid_log_post_header_fwd.hpp - src/binsrv/event/gtid_log_post_header.hpp - src/binsrv/event/gtid_log_post_header.cpp + src/binsrv/events/gtid_log_post_header_fwd.hpp + src/binsrv/events/gtid_log_post_header.hpp + src/binsrv/events/gtid_log_post_header.cpp - src/binsrv/event/gtid_log_post_header_impl_fwd.hpp - src/binsrv/event/gtid_log_post_header_impl.hpp + src/binsrv/events/gtid_log_post_header_impl_fwd.hpp + src/binsrv/events/gtid_log_post_header_impl.hpp - src/binsrv/event/gtid_tagged_log_body_impl_fwd.hpp - src/binsrv/event/gtid_tagged_log_body_impl.hpp - src/binsrv/event/gtid_tagged_log_body_impl.cpp + src/binsrv/events/gtid_tagged_log_body_impl_fwd.hpp + src/binsrv/events/gtid_tagged_log_body_impl.hpp + src/binsrv/events/gtid_tagged_log_body_impl.cpp - src/binsrv/event/gtid_tagged_log_post_header_impl_fwd.hpp - src/binsrv/event/gtid_tagged_log_post_header_impl.hpp + src/binsrv/events/gtid_tagged_log_post_header_impl_fwd.hpp + src/binsrv/events/gtid_tagged_log_post_header_impl.hpp - src/binsrv/event/previous_gtids_log_body_impl_fwd.hpp - src/binsrv/event/previous_gtids_log_body_impl.hpp - src/binsrv/event/previous_gtids_log_body_impl.cpp + src/binsrv/events/previous_gtids_log_body_impl_fwd.hpp + src/binsrv/events/previous_gtids_log_body_impl.hpp + src/binsrv/events/previous_gtids_log_body_impl.cpp - src/binsrv/event/previous_gtids_log_post_header_impl_fwd.hpp - src/binsrv/event/previous_gtids_log_post_header_impl.hpp + src/binsrv/events/previous_gtids_log_post_header_impl_fwd.hpp + src/binsrv/events/previous_gtids_log_post_header_impl.hpp - src/binsrv/event/protocol_traits_fwd.hpp - src/binsrv/event/protocol_traits.hpp - src/binsrv/event/protocol_traits.cpp + src/binsrv/events/protocol_traits_fwd.hpp + src/binsrv/events/protocol_traits.hpp + src/binsrv/events/protocol_traits.cpp - src/binsrv/event/reader_context_fwd.hpp - src/binsrv/event/reader_context.hpp - src/binsrv/event/reader_context.cpp + src/binsrv/events/reader_context_fwd.hpp + src/binsrv/events/reader_context.hpp + src/binsrv/events/reader_context.cpp - src/binsrv/event/rotate_body_impl_fwd.hpp - src/binsrv/event/rotate_body_impl.hpp - src/binsrv/event/rotate_body_impl.cpp + src/binsrv/events/rotate_body_impl_fwd.hpp + src/binsrv/events/rotate_body_impl.hpp + src/binsrv/events/rotate_body_impl.cpp - src/binsrv/event/rotate_post_header_impl_fwd.hpp - src/binsrv/event/rotate_post_header_impl.hpp - src/binsrv/event/rotate_post_header_impl.cpp + src/binsrv/events/rotate_post_header_impl_fwd.hpp + src/binsrv/events/rotate_post_header_impl.hpp + src/binsrv/events/rotate_post_header_impl.cpp - src/binsrv/event/stop_body_impl_fwd.hpp - src/binsrv/event/stop_body_impl.hpp + src/binsrv/events/stop_body_impl_fwd.hpp + src/binsrv/events/stop_body_impl.hpp - src/binsrv/event/stop_post_header_impl_fwd.hpp - src/binsrv/event/stop_post_header_impl.hpp + src/binsrv/events/stop_post_header_impl_fwd.hpp + src/binsrv/events/stop_post_header_impl.hpp - src/binsrv/event/unknown_body_fwd.hpp - src/binsrv/event/unknown_body.hpp - src/binsrv/event/unknown_body.cpp + src/binsrv/events/unknown_body_fwd.hpp + src/binsrv/events/unknown_body.hpp + src/binsrv/events/unknown_body.cpp - src/binsrv/event/unknown_post_header_fwd.hpp - src/binsrv/event/unknown_post_header.hpp - src/binsrv/event/unknown_post_header.cpp + src/binsrv/events/unknown_post_header_fwd.hpp + src/binsrv/events/unknown_post_header.hpp + src/binsrv/events/unknown_post_header.cpp # gtid data structure files src/binsrv/gtids/common_types.hpp diff --git a/src/app.cpp b/src/app.cpp index 2eb0ed3..8da9bca 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -59,10 +59,10 @@ #include "binsrv/models/error_response.hpp" #include "binsrv/models/search_response.hpp" -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/common_header_flag_type.hpp" -#include "binsrv/event/event.hpp" -#include "binsrv/event/reader_context.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/common_header_flag_type.hpp" +#include "binsrv/events/event.hpp" +#include "binsrv/events/reader_context.hpp" #include "easymysql/connection.hpp" #include "easymysql/connection_config.hpp" @@ -375,16 +375,16 @@ void log_span_dump(binsrv::basic_logger &logger, } } -void process_artificial_rotate_event(const binsrv::event::event ¤t_event, +void process_artificial_rotate_event(const binsrv::events::event ¤t_event, binsrv::basic_logger &logger, binsrv::storage &storage) { assert(current_event.get_common_header().get_type_code() == - binsrv::event::code_type::rotate); + binsrv::events::code_type::rotate); assert(current_event.get_common_header().get_flags().has_element( - binsrv::event::common_header_flag_type::artificial)); + binsrv::events::common_header_flag_type::artificial)); const auto ¤t_rotate_body = - current_event.get_body(); + current_event.get_body(); bool binlog_opening_needed{true}; @@ -405,7 +405,7 @@ void process_artificial_rotate_event(const binsrv::event::event ¤t_event, // in addition, in position-based replication mode we also need to check // the position const auto ¤t_rotate_post_header = - current_event.get_post_header(); + current_event.get_post_header(); if (current_rotate_post_header.get_position_raw() != storage.get_current_position()) { util::exception_location().raise( @@ -461,19 +461,19 @@ void process_rotate_or_stop_event(binsrv::basic_logger &logger, "storage: closed binlog file: " + old_binlog_name); } -void process_binlog_event(const binsrv::event::event ¤t_event, +void process_binlog_event(const binsrv::events::event ¤t_event, util::const_byte_span portion, binsrv::basic_logger &logger, - binsrv::event::reader_context &context, + binsrv::events::reader_context &context, binsrv::storage &storage) { const auto ¤t_common_header = current_event.get_common_header(); const auto code = current_common_header.get_type_code(); const auto is_artificial{current_common_header.get_flags().has_element( - binsrv::event::common_header_flag_type::artificial)}; + binsrv::events::common_header_flag_type::artificial)}; // processing the very first event in the sequence - artificial ROTATE event - if (code == binsrv::event::code_type::rotate && is_artificial) { + if (code == binsrv::events::code_type::rotate && is_artificial) { process_artificial_rotate_event(current_event, logger, storage); } @@ -486,8 +486,8 @@ void process_binlog_event(const binsrv::event::event ¤t_event, // processing the very last event in the sequence - either a non-artificial // ROTATE event or a STOP event - if ((code == binsrv::event::code_type::rotate && !is_artificial) || - code == binsrv::event::code_type::stop) { + if ((code == binsrv::events::code_type::rotate && !is_artificial) || + code == binsrv::events::code_type::stop) { process_rotate_or_stop_event(logger, storage); } } @@ -573,7 +573,7 @@ void receive_binlog_events( util::const_byte_span portion; - binsrv::event::reader_context context{ + binsrv::events::reader_context context{ connection.get_server_version(), verify_checksum, storage.get_replication_mode(), storage.get_current_binlog_name(), static_cast(storage.get_current_position())}; @@ -594,7 +594,7 @@ void receive_binlog_events( // the ROTATE and FORMAT_DESCRIPTION events only, every other one // can be just considered as a data portion (unless we want to do // basic integrity checks like event sizes / position and CRC) - const binsrv::event::event current_event{context, portion}; + const binsrv::events::event current_event{context, portion}; const auto ¤t_header{current_event.get_common_header()}; auto readable_flags{current_header.get_readable_flags()}; logger.log( diff --git a/src/binsrv/event/code_type.hpp b/src/binsrv/event/code_type.hpp deleted file mode 100644 index c9faa44..0000000 --- a/src/binsrv/event/code_type.hpp +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) 2023-2024 Percona and/or its affiliates. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License, version 2.0, -// as published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License, version 2.0, for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -#ifndef BINSRV_EVENT_CODE_TYPE_HPP -#define BINSRV_EVENT_CODE_TYPE_HPP - -#include "binsrv/event/code_type_fwd.hpp" // IWYU pragma: export - -#include -#include -#include -#include - -namespace binsrv::event { - -// NOLINTBEGIN(cppcoreguidelines-macro-usage) -// Event type codes copied from -// https://github.com/mysql/mysql-server/blob/mysql-8.0.43/libbinlogevents/include/binlog_event.h#L275 -// https://github.com/mysql/mysql-server/blob/mysql-8.4.6/libs/mysql/binlog/event/binlog_event.h#L286 -// clang-format off -#define BINSRV_EVENT_CODE_TYPE_XY_SEQUENCE() \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(unknown , 0), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(start_v3 , 1), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(query , 2), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(stop , 3), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(rotate , 4), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(intvar , 5), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(obsolete_6 , 6), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(slave , 7), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(obsolete_8 , 8), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(append_block , 9), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(obsolete_10 , 10), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(delete_file , 11), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(obsolete_12 , 12), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(rand , 13), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(user_var , 14), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(format_description , 15), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(xid , 16), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(begin_load_query , 17), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(execute_load_query , 18), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(table_map , 19), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(obsolete_20 , 20), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(obsolete_21 , 21), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(obsolete_22 , 22), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(write_rows_v1 , 23), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(update_rows_v1 , 24), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(delete_rows_v1 , 25), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(incident , 26), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(heartbeat_log , 27), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(ignorable_log , 28), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(rows_query_log , 29), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(write_rows , 30), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(update_rows , 31), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(delete_rows , 32), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(gtid_log , 33), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(anonymous_gtid_log , 34), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(previous_gtids_log , 35), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(transaction_context, 36), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(view_change , 37), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(xa_prepare_log , 38), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(partial_update_rows, 39), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(transaction_payload, 40), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(heartbeat_log_v2 , 41), \ - BINSRV_EVENT_CODE_TYPE_XY_MACRO(gtid_tagged_log , 42) -// clang-format on - -#define BINSRV_EVENT_CODE_TYPE_XY_MACRO(X, Y) X = Y -// NOLINTNEXTLINE(readability-enum-initial-value,cert-int09-c) -enum class code_type : std::uint8_t { - BINSRV_EVENT_CODE_TYPE_XY_SEQUENCE(), - delimiter -}; -#undef BINSRV_EVENT_CODE_TYPE_XY_MACRO - -inline std::string_view to_string_view(code_type code) noexcept { - using namespace std::string_view_literals; - using nv_pair = std::pair; -#define BINSRV_EVENT_CODE_TYPE_XY_MACRO(X, Y) \ - nv_pair { code_type::X, #X##sv } - static constexpr std::array labels{BINSRV_EVENT_CODE_TYPE_XY_SEQUENCE(), - nv_pair{code_type::delimiter, ""sv}}; -#undef BINSRV_EVENT_CODE_TYPE_XY_MACRO - // NOLINTNEXTLINE(llvm-qualified-auto,readability-qualified-auto) - const auto fnd{std::ranges::find(labels, code, &nv_pair::first)}; - return fnd == std::end(labels) ? ""sv : fnd->second; -} -#undef BINSRV_EVENT_CODE_TYPE_XY_SEQUENCE -// NOLINTEND(cppcoreguidelines-macro-usage) - -} // namespace binsrv::event - -#endif // BINSRV_EVENT_CODE_TYPE_HPP diff --git a/src/binsrv/event/anonymous_gtid_log_body_impl.hpp b/src/binsrv/events/anonymous_gtid_log_body_impl.hpp similarity index 71% rename from src/binsrv/event/anonymous_gtid_log_body_impl.hpp rename to src/binsrv/events/anonymous_gtid_log_body_impl.hpp index 7cc806f..9a56609 100644 --- a/src/binsrv/event/anonymous_gtid_log_body_impl.hpp +++ b/src/binsrv/events/anonymous_gtid_log_body_impl.hpp @@ -13,14 +13,14 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_ANONYMOUS_GTID_LOG_BODY_IMPL_HPP -#define BINSRV_EVENT_ANONYMOUS_GTID_LOG_BODY_IMPL_HPP +#ifndef BINSRV_EVENTS_ANONYMOUS_GTID_LOG_BODY_IMPL_HPP +#define BINSRV_EVENTS_ANONYMOUS_GTID_LOG_BODY_IMPL_HPP -#include "binsrv/event/anonymous_gtid_log_body_impl_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/anonymous_gtid_log_body_impl_fwd.hpp" // IWYU pragma: export -#include "binsrv/event/gtid_log_body.hpp" +#include "binsrv/events/gtid_log_body.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class [[nodiscard]] generic_body_impl { @@ -28,6 +28,6 @@ class [[nodiscard]] generic_body_impl { using redirect_type = gtid_log_body; }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_ANONYMOUS_GTID_LOG_BODY_IMPL_HPP +#endif // BINSRV_EVENTS_ANONYMOUS_GTID_LOG_BODY_IMPL_HPP diff --git a/src/binsrv/event/anonymous_gtid_log_body_impl_fwd.hpp b/src/binsrv/events/anonymous_gtid_log_body_impl_fwd.hpp similarity index 71% rename from src/binsrv/event/anonymous_gtid_log_body_impl_fwd.hpp rename to src/binsrv/events/anonymous_gtid_log_body_impl_fwd.hpp index 5061aee..a957ceb 100644 --- a/src/binsrv/event/anonymous_gtid_log_body_impl_fwd.hpp +++ b/src/binsrv/events/anonymous_gtid_log_body_impl_fwd.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_ANONYMOUS_GTID_LOG_BODY_IMPL_FWD_HPP -#define BINSRV_EVENT_ANONYMOUS_GTID_LOG_BODY_IMPL_FWD_HPP +#ifndef BINSRV_EVENTS_ANONYMOUS_GTID_LOG_BODY_IMPL_FWD_HPP +#define BINSRV_EVENTS_ANONYMOUS_GTID_LOG_BODY_IMPL_FWD_HPP -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_body_fwd.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_body_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class generic_body_impl; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_ANONYMOUS_GTID_LOG_BODY_IMPL_FWD_HPP +#endif // BINSRV_EVENTS_ANONYMOUS_GTID_LOG_BODY_IMPL_FWD_HPP diff --git a/src/binsrv/event/anonymous_gtid_log_post_header_impl.hpp b/src/binsrv/events/anonymous_gtid_log_post_header_impl.hpp similarity index 69% rename from src/binsrv/event/anonymous_gtid_log_post_header_impl.hpp rename to src/binsrv/events/anonymous_gtid_log_post_header_impl.hpp index d3bd7a0..18655cb 100644 --- a/src/binsrv/event/anonymous_gtid_log_post_header_impl.hpp +++ b/src/binsrv/events/anonymous_gtid_log_post_header_impl.hpp @@ -13,14 +13,14 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_ANONYMOUS_GTID_LOG_POST_HEADER_IMPL_HPP -#define BINSRV_EVENT_ANONYMOUS_GTID_LOG_POST_HEADER_IMPL_HPP +#ifndef BINSRV_EVENTS_ANONYMOUS_GTID_LOG_POST_HEADER_IMPL_HPP +#define BINSRV_EVENTS_ANONYMOUS_GTID_LOG_POST_HEADER_IMPL_HPP -#include "binsrv/event/anonymous_gtid_log_post_header_impl_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/anonymous_gtid_log_post_header_impl_fwd.hpp" // IWYU pragma: export -#include "binsrv/event/gtid_log_post_header.hpp" +#include "binsrv/events/gtid_log_post_header.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class [[nodiscard]] generic_post_header_impl { @@ -28,6 +28,6 @@ class [[nodiscard]] generic_post_header_impl { using redirect_type = gtid_log_post_header; }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_ANONYMOUS_GTID_LOG_POST_HEADER_IMPL_HPP +#endif // BINSRV_EVENTS_ANONYMOUS_GTID_LOG_POST_HEADER_IMPL_HPP diff --git a/src/binsrv/event/anonymous_gtid_log_post_header_impl_fwd.hpp b/src/binsrv/events/anonymous_gtid_log_post_header_impl_fwd.hpp similarity index 69% rename from src/binsrv/event/anonymous_gtid_log_post_header_impl_fwd.hpp rename to src/binsrv/events/anonymous_gtid_log_post_header_impl_fwd.hpp index ae24767..745b354 100644 --- a/src/binsrv/event/anonymous_gtid_log_post_header_impl_fwd.hpp +++ b/src/binsrv/events/anonymous_gtid_log_post_header_impl_fwd.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_ANONYMOUS_GTID_LOG_POST_HEADER_IMPL_FWD_HPP -#define BINSRV_EVENT_ANONYMOUS_GTID_LOG_POST_HEADER_IMPL_FWD_HPP +#ifndef BINSRV_EVENTS_ANONYMOUS_GTID_LOG_POST_HEADER_IMPL_FWD_HPP +#define BINSRV_EVENTS_ANONYMOUS_GTID_LOG_POST_HEADER_IMPL_FWD_HPP -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_post_header_fwd.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_post_header_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class generic_post_header_impl; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_ANONYMOUS_GTID_LOG_POST_HEADER_IMPL_FWD_HPP +#endif // BINSRV_EVENTS_ANONYMOUS_GTID_LOG_POST_HEADER_IMPL_FWD_HPP diff --git a/src/binsrv/event/checksum_algorithm_type.hpp b/src/binsrv/events/checksum_algorithm_type.hpp similarity index 89% rename from src/binsrv/event/checksum_algorithm_type.hpp rename to src/binsrv/events/checksum_algorithm_type.hpp index 148b3e1..0bdc1e4 100644 --- a/src/binsrv/event/checksum_algorithm_type.hpp +++ b/src/binsrv/events/checksum_algorithm_type.hpp @@ -13,17 +13,17 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_CHECKSUM_ALGORITHM_TYPE_HPP -#define BINSRV_EVENT_CHECKSUM_ALGORITHM_TYPE_HPP +#ifndef BINSRV_EVENTS_CHECKSUM_ALGORITHM_TYPE_HPP +#define BINSRV_EVENTS_CHECKSUM_ALGORITHM_TYPE_HPP -#include "binsrv/event/checksum_algorithm_type_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/checksum_algorithm_type_fwd.hpp" // IWYU pragma: export #include #include #include #include -namespace binsrv::event { +namespace binsrv::events { // NOLINTBEGIN(cppcoreguidelines-macro-usage) // Checksum algorithm type codes copied from @@ -59,6 +59,6 @@ inline std::string_view to_string_view(checksum_algorithm_type code) noexcept { #undef BINSRV_CHECKSUM_ALGORITHM_TYPE_XY_SEQUENCE // NOLINTEND(cppcoreguidelines-macro-usage) -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_CHECKSUM_ALGORITHM_TYPE_HPP +#endif // BINSRV_EVENTS_CHECKSUM_ALGORITHM_TYPE_HPP diff --git a/src/binsrv/event/checksum_algorithm_type_fwd.hpp b/src/binsrv/events/checksum_algorithm_type_fwd.hpp similarity index 79% rename from src/binsrv/event/checksum_algorithm_type_fwd.hpp rename to src/binsrv/events/checksum_algorithm_type_fwd.hpp index a030d70..722773d 100644 --- a/src/binsrv/event/checksum_algorithm_type_fwd.hpp +++ b/src/binsrv/events/checksum_algorithm_type_fwd.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_CHECKSUM_ALGORITHM_TYPE_FWD_HPP -#define BINSRV_EVENT_CHECKSUM_ALGORITHM_TYPE_FWD_HPP +#ifndef BINSRV_EVENTS_CHECKSUM_ALGORITHM_TYPE_FWD_HPP +#define BINSRV_EVENTS_CHECKSUM_ALGORITHM_TYPE_FWD_HPP #include -namespace binsrv::event { +namespace binsrv::events { // NOLINTNEXTLINE(readability-enum-initial-value,cert-int09-c) enum class checksum_algorithm_type : std::uint8_t; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_CHECKSUM_ALGORITHM_TYPE_FWD_HPP +#endif // BINSRV_EVENTS_CHECKSUM_ALGORITHM_TYPE_FWD_HPP diff --git a/src/binsrv/events/code_type.hpp b/src/binsrv/events/code_type.hpp new file mode 100644 index 0000000..44f3f5f --- /dev/null +++ b/src/binsrv/events/code_type.hpp @@ -0,0 +1,104 @@ +// Copyright (c) 2023-2024 Percona and/or its affiliates. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License, version 2.0, +// as published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License, version 2.0, for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#ifndef BINSRV_EVENTS_CODE_TYPE_HPP +#define BINSRV_EVENTS_CODE_TYPE_HPP + +#include "binsrv/events/code_type_fwd.hpp" // IWYU pragma: export + +#include +#include +#include +#include + +namespace binsrv::events { + +// NOLINTBEGIN(cppcoreguidelines-macro-usage) +// Event type codes copied from +// https://github.com/mysql/mysql-server/blob/mysql-8.0.43/libbinlogevents/include/binlog_event.h#L275 +// https://github.com/mysql/mysql-server/blob/mysql-8.4.6/libs/mysql/binlog/event/binlog_event.h#L286 +// clang-format off +#define BINSRV_EVENTS_CODE_TYPE_XY_SEQUENCE() \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(unknown , 0), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(start_v3 , 1), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(query , 2), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(stop , 3), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(rotate , 4), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(intvar , 5), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(obsolete_6 , 6), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(slave , 7), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(obsolete_8 , 8), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(append_block , 9), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(obsolete_10 , 10), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(delete_file , 11), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(obsolete_12 , 12), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(rand , 13), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(user_var , 14), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(format_description , 15), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(xid , 16), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(begin_load_query , 17), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(execute_load_query , 18), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(table_map , 19), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(obsolete_20 , 20), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(obsolete_21 , 21), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(obsolete_22 , 22), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(write_rows_v1 , 23), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(update_rows_v1 , 24), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(delete_rows_v1 , 25), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(incident , 26), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(heartbeat_log , 27), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(ignorable_log , 28), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(rows_query_log , 29), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(write_rows , 30), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(update_rows , 31), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(delete_rows , 32), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(gtid_log , 33), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(anonymous_gtid_log , 34), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(previous_gtids_log , 35), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(transaction_context, 36), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(view_change , 37), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(xa_prepare_log , 38), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(partial_update_rows, 39), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(transaction_payload, 40), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(heartbeat_log_v2 , 41), \ + BINSRV_EVENTS_CODE_TYPE_XY_MACRO(gtid_tagged_log , 42) +// clang-format on + +#define BINSRV_EVENTS_CODE_TYPE_XY_MACRO(X, Y) X = Y +// NOLINTNEXTLINE(readability-enum-initial-value,cert-int09-c) +enum class code_type : std::uint8_t { + BINSRV_EVENTS_CODE_TYPE_XY_SEQUENCE(), + delimiter +}; +#undef BINSRV_EVENTS_CODE_TYPE_XY_MACRO + +inline std::string_view to_string_view(code_type code) noexcept { + using namespace std::string_view_literals; + using nv_pair = std::pair; +#define BINSRV_EVENTS_CODE_TYPE_XY_MACRO(X, Y) \ + nv_pair { code_type::X, #X##sv } + static constexpr std::array labels{BINSRV_EVENTS_CODE_TYPE_XY_SEQUENCE(), + nv_pair{code_type::delimiter, ""sv}}; +#undef BINSRV_EVENTS_CODE_TYPE_XY_MACRO + // NOLINTNEXTLINE(llvm-qualified-auto,readability-qualified-auto) + const auto fnd{std::ranges::find(labels, code, &nv_pair::first)}; + return fnd == std::end(labels) ? ""sv : fnd->second; +} +#undef BINSRV_EVENTS_CODE_TYPE_XY_SEQUENCE +// NOLINTEND(cppcoreguidelines-macro-usage) + +} // namespace binsrv::events + +#endif // BINSRV_EVENTS_CODE_TYPE_HPP diff --git a/src/binsrv/event/code_type_fwd.hpp b/src/binsrv/events/code_type_fwd.hpp similarity index 82% rename from src/binsrv/event/code_type_fwd.hpp rename to src/binsrv/events/code_type_fwd.hpp index 26e429f..cb5e313 100644 --- a/src/binsrv/event/code_type_fwd.hpp +++ b/src/binsrv/events/code_type_fwd.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_CODE_TYPE_FWD_HPP -#define BINSRV_EVENT_CODE_TYPE_FWD_HPP +#ifndef BINSRV_EVENTS_CODE_TYPE_FWD_HPP +#define BINSRV_EVENTS_CODE_TYPE_FWD_HPP #include -namespace binsrv::event { +namespace binsrv::events { // NOLINTNEXTLINE(readability-enum-initial-value,cert-int09-c) enum class code_type : std::uint8_t; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_CODE_TYPE_FWD_HPP +#endif // BINSRV_EVENTS_CODE_TYPE_FWD_HPP diff --git a/src/binsrv/event/common_header.cpp b/src/binsrv/events/common_header.cpp similarity index 96% rename from src/binsrv/event/common_header.cpp rename to src/binsrv/events/common_header.cpp index 0cca433..537ae42 100644 --- a/src/binsrv/event/common_header.cpp +++ b/src/binsrv/events/common_header.cpp @@ -13,7 +13,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/common_header.hpp" +#include "binsrv/events/common_header.hpp" #include #include @@ -25,8 +25,8 @@ #include "binsrv/ctime_timestamp.hpp" -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/common_header_flag_type.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/common_header_flag_type.hpp" #include "util/byte_span_extractors.hpp" #include "util/byte_span_fwd.hpp" @@ -34,7 +34,7 @@ #include "util/exception_location_helpers.hpp" #include "util/flag_set.hpp" -namespace binsrv::event { +namespace binsrv::events { common_header::common_header(util::const_byte_span portion) { // TODO: rework with direct member initialization @@ -127,4 +127,4 @@ std::ostream &operator<<(std::ostream &output, const common_header &obj) { << ", flags: " << obj.get_readable_flags(); } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/common_header.hpp b/src/binsrv/events/common_header.hpp similarity index 85% rename from src/binsrv/event/common_header.hpp rename to src/binsrv/events/common_header.hpp index 39ac2e1..65e544c 100644 --- a/src/binsrv/event/common_header.hpp +++ b/src/binsrv/events/common_header.hpp @@ -13,10 +13,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_COMMON_HEADER_HPP -#define BINSRV_EVENT_COMMON_HEADER_HPP +#ifndef BINSRV_EVENTS_COMMON_HEADER_HPP +#define BINSRV_EVENTS_COMMON_HEADER_HPP -#include "binsrv/event/common_header_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/common_header_fwd.hpp" // IWYU pragma: export #include #include @@ -25,13 +25,13 @@ #include "binsrv/ctime_timestamp_fwd.hpp" -#include "binsrv/event/code_type_fwd.hpp" -#include "binsrv/event/common_header_flag_type_fwd.hpp" -#include "binsrv/event/protocol_traits_fwd.hpp" +#include "binsrv/events/code_type_fwd.hpp" +#include "binsrv/events/common_header_flag_type_fwd.hpp" +#include "binsrv/events/protocol_traits_fwd.hpp" #include "util/byte_span_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { class [[nodiscard]] common_header { public: @@ -80,6 +80,6 @@ class [[nodiscard]] common_header { std::uint8_t type_code_{}; // 1 }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_COMMON_HEADER_HPP +#endif // BINSRV_EVENTS_COMMON_HEADER_HPP diff --git a/src/binsrv/event/common_header_flag_type.hpp b/src/binsrv/events/common_header_flag_type.hpp similarity index 63% rename from src/binsrv/event/common_header_flag_type.hpp rename to src/binsrv/events/common_header_flag_type.hpp index 4807bd3..0a81d9a 100644 --- a/src/binsrv/event/common_header_flag_type.hpp +++ b/src/binsrv/events/common_header_flag_type.hpp @@ -13,10 +13,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_HPP -#define BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_HPP +#ifndef BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_HPP +#define BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_HPP -#include "binsrv/event/common_header_flag_type_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/common_header_flag_type_fwd.hpp" // IWYU pragma: export #include #include @@ -25,7 +25,7 @@ #include "util/flag_set.hpp" -namespace binsrv::event { +namespace binsrv::events { // NOLINTBEGIN(cppcoreguidelines-macro-usage) // Event flags copied from @@ -40,41 +40,41 @@ namespace binsrv::event { // closed). // Events received via network stream should never have this flag set. // clang-format off -#define BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_SEQUENCE() \ - BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_MACRO(binlog_in_use , 0x001U), \ - BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_MACRO(thread_specific, 0x004U), \ - BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_MACRO(suppress_use , 0x008U), \ - BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_MACRO(artificial , 0x020U), \ - BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_MACRO(relay_log , 0x040U), \ - BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_MACRO(ignorable , 0x080U), \ - BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_MACRO(no_filter , 0x100U), \ - BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_MACRO(mts_isolate , 0x200U) +#define BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_SEQUENCE() \ + BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_MACRO(binlog_in_use , 0x001U), \ + BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_MACRO(thread_specific, 0x004U), \ + BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_MACRO(suppress_use , 0x008U), \ + BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_MACRO(artificial , 0x020U), \ + BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_MACRO(relay_log , 0x040U), \ + BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_MACRO(ignorable , 0x080U), \ + BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_MACRO(no_filter , 0x100U), \ + BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_MACRO(mts_isolate , 0x200U) // clang-format on -#define BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_MACRO(X, Y) X = Y +#define BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_MACRO(X, Y) X = Y // NOLINTNEXTLINE(readability-enum-initial-value,cert-int09-c) enum class common_header_flag_type : std::uint16_t { - BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_SEQUENCE(), + BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_SEQUENCE(), delimiter }; -#undef BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_MACRO +#undef BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_MACRO inline std::string_view to_string_view(common_header_flag_type code) noexcept { using namespace std::string_view_literals; using nv_pair = std::pair; -#define BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_MACRO(X, Y) \ +#define BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_MACRO(X, Y) \ nv_pair { common_header_flag_type::X, #X##sv } static constexpr std::array labels{ - BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_SEQUENCE(), + BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_SEQUENCE(), nv_pair{common_header_flag_type::delimiter, ""sv}}; -#undef BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_MACRO +#undef BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_MACRO // NOLINTNEXTLINE(llvm-qualified-auto,readability-qualified-auto) const auto fnd{std::ranges::find(labels, code, &nv_pair::first)}; return fnd == std::end(labels) ? ""sv : fnd->second; } -#undef BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_XY_SEQUENCE +#undef BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_XY_SEQUENCE // NOLINTEND(cppcoreguidelines-macro-usage) -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_HPP +#endif // BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_HPP diff --git a/src/binsrv/event/common_header_flag_type_fwd.hpp b/src/binsrv/events/common_header_flag_type_fwd.hpp similarity index 81% rename from src/binsrv/event/common_header_flag_type_fwd.hpp rename to src/binsrv/events/common_header_flag_type_fwd.hpp index 4f3d1a5..d812db2 100644 --- a/src/binsrv/event/common_header_flag_type_fwd.hpp +++ b/src/binsrv/events/common_header_flag_type_fwd.hpp @@ -13,20 +13,20 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_FWD_HPP -#define BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_FWD_HPP +#ifndef BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_FWD_HPP +#define BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_FWD_HPP #include #include "util/flag_set_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { // NOLINTNEXTLINE(readability-enum-initial-value,cert-int09-c) enum class common_header_flag_type : std::uint16_t; using common_header_flag_set = util::flag_set; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_COMMON_HEADER_FLAG_TYPE_FWD_HPP +#endif // BINSRV_EVENTS_COMMON_HEADER_FLAG_TYPE_FWD_HPP diff --git a/src/binsrv/event/common_header_fwd.hpp b/src/binsrv/events/common_header_fwd.hpp similarity index 81% rename from src/binsrv/event/common_header_fwd.hpp rename to src/binsrv/events/common_header_fwd.hpp index 507793b..7774627 100644 --- a/src/binsrv/event/common_header_fwd.hpp +++ b/src/binsrv/events/common_header_fwd.hpp @@ -13,17 +13,17 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_COMMON_HEADER_FWD_HPP -#define BINSRV_EVENT_COMMON_HEADER_FWD_HPP +#ifndef BINSRV_EVENTS_COMMON_HEADER_FWD_HPP +#define BINSRV_EVENTS_COMMON_HEADER_FWD_HPP #include -namespace binsrv::event { +namespace binsrv::events { class common_header; std::ostream &operator<<(std::ostream &output, const common_header &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_COMMON_HEADER_FWD_HPP +#endif // BINSRV_EVENTS_COMMON_HEADER_FWD_HPP diff --git a/src/binsrv/event/empty_body.cpp b/src/binsrv/events/empty_body.cpp similarity index 92% rename from src/binsrv/event/empty_body.cpp rename to src/binsrv/events/empty_body.cpp index 475760f..67db89a 100644 --- a/src/binsrv/event/empty_body.cpp +++ b/src/binsrv/events/empty_body.cpp @@ -13,7 +13,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/empty_body.hpp" +#include "binsrv/events/empty_body.hpp" #include #include @@ -22,7 +22,7 @@ #include "util/byte_span_fwd.hpp" #include "util/exception_location_helpers.hpp" -namespace binsrv::event { +namespace binsrv::events { empty_body::empty_body(util::const_byte_span portion) { if (std::size(portion) != size_in_bytes) { @@ -35,4 +35,4 @@ std::ostream &operator<<(std::ostream &output, const empty_body & /* obj */) { return output; } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/empty_body.hpp b/src/binsrv/events/empty_body.hpp similarity index 79% rename from src/binsrv/event/empty_body.hpp rename to src/binsrv/events/empty_body.hpp index 9f0ddb0..4da3568 100644 --- a/src/binsrv/event/empty_body.hpp +++ b/src/binsrv/events/empty_body.hpp @@ -13,14 +13,14 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_EMPTY_BODY_HPP -#define BINSRV_EVENT_EMPTY_BODY_HPP +#ifndef BINSRV_EVENTS_EMPTY_BODY_HPP +#define BINSRV_EVENTS_EMPTY_BODY_HPP -#include "binsrv/event/empty_body_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/empty_body_fwd.hpp" // IWYU pragma: export #include "util/byte_span_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { class [[nodiscard]] empty_body { public: @@ -29,6 +29,6 @@ class [[nodiscard]] empty_body { explicit empty_body(util::const_byte_span portion); }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_EMPTY_BODY_HPP +#endif // BINSRV_EVENTS_EMPTY_BODY_HPP diff --git a/src/binsrv/event/empty_body_fwd.hpp b/src/binsrv/events/empty_body_fwd.hpp similarity index 82% rename from src/binsrv/event/empty_body_fwd.hpp rename to src/binsrv/events/empty_body_fwd.hpp index 817c38e..3d8ddba 100644 --- a/src/binsrv/event/empty_body_fwd.hpp +++ b/src/binsrv/events/empty_body_fwd.hpp @@ -13,17 +13,17 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_EMPTY_BODY_FWD_HPP -#define BINSRV_EVENT_EMPTY_BODY_FWD_HPP +#ifndef BINSRV_EVENTS_EMPTY_BODY_FWD_HPP +#define BINSRV_EVENTS_EMPTY_BODY_FWD_HPP #include -namespace binsrv::event { +namespace binsrv::events { class empty_body; std::ostream &operator<<(std::ostream &output, const empty_body &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_EMPTY_BODY_FWD_HPP +#endif // BINSRV_EVENTS_EMPTY_BODY_FWD_HPP diff --git a/src/binsrv/event/empty_post_header.cpp b/src/binsrv/events/empty_post_header.cpp similarity index 92% rename from src/binsrv/event/empty_post_header.cpp rename to src/binsrv/events/empty_post_header.cpp index f377d98..bbb8b3d 100644 --- a/src/binsrv/event/empty_post_header.cpp +++ b/src/binsrv/events/empty_post_header.cpp @@ -13,7 +13,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/empty_post_header.hpp" +#include "binsrv/events/empty_post_header.hpp" #include #include @@ -22,7 +22,7 @@ #include "util/byte_span_fwd.hpp" #include "util/exception_location_helpers.hpp" -namespace binsrv::event { +namespace binsrv::events { empty_post_header::empty_post_header(util::const_byte_span portion) { if (std::size(portion) != size_in_bytes) { @@ -36,4 +36,4 @@ std::ostream &operator<<(std::ostream &output, return output; } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/empty_post_header.hpp b/src/binsrv/events/empty_post_header.hpp similarity index 77% rename from src/binsrv/event/empty_post_header.hpp rename to src/binsrv/events/empty_post_header.hpp index dc2b34b..6c0011c 100644 --- a/src/binsrv/event/empty_post_header.hpp +++ b/src/binsrv/events/empty_post_header.hpp @@ -13,14 +13,14 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_EMPTY_POST_HEADER_HPP -#define BINSRV_EVENT_EMPTY_POST_HEADER_HPP +#ifndef BINSRV_EVENTS_EMPTY_POST_HEADER_HPP +#define BINSRV_EVENTS_EMPTY_POST_HEADER_HPP -#include "binsrv/event/empty_post_header_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/empty_post_header_fwd.hpp" // IWYU pragma: export #include "util/byte_span_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { class [[nodiscard]] empty_post_header { public: @@ -29,6 +29,6 @@ class [[nodiscard]] empty_post_header { explicit empty_post_header(util::const_byte_span portion); }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_EMPTY_POST_HEADER_HPP +#endif // BINSRV_EVENTS_EMPTY_POST_HEADER_HPP diff --git a/src/binsrv/event/empty_post_header_fwd.hpp b/src/binsrv/events/empty_post_header_fwd.hpp similarity index 80% rename from src/binsrv/event/empty_post_header_fwd.hpp rename to src/binsrv/events/empty_post_header_fwd.hpp index 2ea5236..5669373 100644 --- a/src/binsrv/event/empty_post_header_fwd.hpp +++ b/src/binsrv/events/empty_post_header_fwd.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_EMPTY_POST_HEADER_FWD_HPP -#define BINSRV_EVENT_EMPTY_POST_HEADER_FWD_HPP +#ifndef BINSRV_EVENTS_EMPTY_POST_HEADER_FWD_HPP +#define BINSRV_EVENTS_EMPTY_POST_HEADER_FWD_HPP #include -namespace binsrv::event { +namespace binsrv::events { class empty_post_header; std::ostream &operator<<(std::ostream &output, const empty_post_header &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_EMPTY_POST_HEADER_FWD_HPP +#endif // BINSRV_EVENTS_EMPTY_POST_HEADER_FWD_HPP diff --git a/src/binsrv/event/event.cpp b/src/binsrv/events/event.cpp similarity index 96% rename from src/binsrv/event/event.cpp rename to src/binsrv/events/event.cpp index a30cbe3..ac9beb1 100644 --- a/src/binsrv/event/event.cpp +++ b/src/binsrv/events/event.cpp @@ -13,7 +13,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/event.hpp" +#include "binsrv/events/event.hpp" #include #include @@ -26,18 +26,18 @@ #include #include -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_body.hpp" -#include "binsrv/event/generic_post_header.hpp" -#include "binsrv/event/protocol_traits_fwd.hpp" -#include "binsrv/event/reader_context.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_body.hpp" +#include "binsrv/events/generic_post_header.hpp" +#include "binsrv/events/protocol_traits_fwd.hpp" +#include "binsrv/events/reader_context.hpp" #include "util/byte_span_fwd.hpp" #include "util/conversion_helpers.hpp" #include "util/crc_helpers.hpp" #include "util/exception_location_helpers.hpp" -namespace binsrv::event { +namespace binsrv::events { event::event(reader_context &context, util::const_byte_span portion) : common_header_{ @@ -215,4 +215,4 @@ std::ostream &operator<<(std::ostream &output, const event &obj) { return output; } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/event.hpp b/src/binsrv/events/event.hpp similarity index 72% rename from src/binsrv/event/event.hpp rename to src/binsrv/events/event.hpp index d023ec7..afb39ab 100644 --- a/src/binsrv/event/event.hpp +++ b/src/binsrv/events/event.hpp @@ -13,10 +13,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_EVENT_HPP -#define BINSRV_EVENT_EVENT_HPP +#ifndef BINSRV_EVENTS_EVENT_HPP +#define BINSRV_EVENTS_EVENT_HPP -#include "binsrv/event/event_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/event_fwd.hpp" // IWYU pragma: export #include #include @@ -31,32 +31,32 @@ #include #include -#include "binsrv/event/anonymous_gtid_log_body_impl.hpp" // IWYU pragma: export -#include "binsrv/event/anonymous_gtid_log_post_header_impl.hpp" // IWYU pragma: export -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/common_header.hpp" // IWYU pragma: export -#include "binsrv/event/footer.hpp" // IWYU pragma: export -#include "binsrv/event/format_description_body_impl.hpp" // IWYU pragma: export -#include "binsrv/event/format_description_post_header_impl.hpp" // IWYU pragma: export -#include "binsrv/event/generic_body.hpp" // IWYU pragma: export -#include "binsrv/event/generic_post_header.hpp" // IWYU pragma: export -#include "binsrv/event/gtid_log_body_impl.hpp" // IWYU pragma: export -#include "binsrv/event/gtid_log_post_header_impl.hpp" // IWYU pragma: export -#include "binsrv/event/gtid_tagged_log_body_impl.hpp" // IWYU pragma: export -#include "binsrv/event/gtid_tagged_log_post_header_impl.hpp" // IWYU pragma: export -#include "binsrv/event/previous_gtids_log_body_impl.hpp" // IWYU pragma: export -#include "binsrv/event/previous_gtids_log_post_header_impl.hpp" // IWYU pragma: export -#include "binsrv/event/reader_context_fwd.hpp" -#include "binsrv/event/rotate_body_impl.hpp" // IWYU pragma: export -#include "binsrv/event/rotate_post_header_impl.hpp" // IWYU pragma: export -#include "binsrv/event/stop_body_impl.hpp" // IWYU pragma: export -#include "binsrv/event/stop_post_header_impl.hpp" // IWYU pragma: export -#include "binsrv/event/unknown_body.hpp" // IWYU pragma: export -#include "binsrv/event/unknown_post_header.hpp" // IWYU pragma: export +#include "binsrv/events/anonymous_gtid_log_body_impl.hpp" // IWYU pragma: export +#include "binsrv/events/anonymous_gtid_log_post_header_impl.hpp" // IWYU pragma: export +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/common_header.hpp" // IWYU pragma: export +#include "binsrv/events/footer.hpp" // IWYU pragma: export +#include "binsrv/events/format_description_body_impl.hpp" // IWYU pragma: export +#include "binsrv/events/format_description_post_header_impl.hpp" // IWYU pragma: export +#include "binsrv/events/generic_body.hpp" // IWYU pragma: export +#include "binsrv/events/generic_post_header.hpp" // IWYU pragma: export +#include "binsrv/events/gtid_log_body_impl.hpp" // IWYU pragma: export +#include "binsrv/events/gtid_log_post_header_impl.hpp" // IWYU pragma: export +#include "binsrv/events/gtid_tagged_log_body_impl.hpp" // IWYU pragma: export +#include "binsrv/events/gtid_tagged_log_post_header_impl.hpp" // IWYU pragma: export +#include "binsrv/events/previous_gtids_log_body_impl.hpp" // IWYU pragma: export +#include "binsrv/events/previous_gtids_log_post_header_impl.hpp" // IWYU pragma: export +#include "binsrv/events/reader_context_fwd.hpp" +#include "binsrv/events/rotate_body_impl.hpp" // IWYU pragma: export +#include "binsrv/events/rotate_post_header_impl.hpp" // IWYU pragma: export +#include "binsrv/events/stop_body_impl.hpp" // IWYU pragma: export +#include "binsrv/events/stop_post_header_impl.hpp" // IWYU pragma: export +#include "binsrv/events/unknown_body.hpp" // IWYU pragma: export +#include "binsrv/events/unknown_post_header.hpp" // IWYU pragma: export #include "util/byte_span_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { class [[nodiscard]] event { private: @@ -159,6 +159,6 @@ class [[nodiscard]] event { util::const_byte_span portion); }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_EVENT_HPP +#endif // BINSRV_EVENTS_EVENT_HPP diff --git a/src/binsrv/event/event_fwd.hpp b/src/binsrv/events/event_fwd.hpp similarity index 83% rename from src/binsrv/event/event_fwd.hpp rename to src/binsrv/events/event_fwd.hpp index c0a78d8..38dc9f0 100644 --- a/src/binsrv/event/event_fwd.hpp +++ b/src/binsrv/events/event_fwd.hpp @@ -13,17 +13,17 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_EVENT_FWD_HPP -#define BINSRV_EVENT_EVENT_FWD_HPP +#ifndef BINSRV_EVENTS_EVENT_FWD_HPP +#define BINSRV_EVENTS_EVENT_FWD_HPP #include -namespace binsrv::event { +namespace binsrv::events { class event; std::ostream &operator<<(std::ostream &output, const event &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_EVENT_FWD_HPP +#endif // BINSRV_EVENTS_EVENT_FWD_HPP diff --git a/src/binsrv/event/footer.cpp b/src/binsrv/events/footer.cpp similarity index 95% rename from src/binsrv/event/footer.cpp rename to src/binsrv/events/footer.cpp index 5560e16..38de064 100644 --- a/src/binsrv/event/footer.cpp +++ b/src/binsrv/events/footer.cpp @@ -13,7 +13,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/footer.hpp" +#include "binsrv/events/footer.hpp" #include #include @@ -31,7 +31,7 @@ #include "util/byte_span_fwd.hpp" #include "util/exception_location_helpers.hpp" -namespace binsrv::event { +namespace binsrv::events { footer::footer(util::const_byte_span portion) { // TODO: rework with direct member initialization @@ -62,4 +62,4 @@ std::ostream &operator<<(std::ostream &output, const footer &obj) { << obj.get_crc_raw(); } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/footer.hpp b/src/binsrv/events/footer.hpp similarity index 82% rename from src/binsrv/event/footer.hpp rename to src/binsrv/events/footer.hpp index 146c4a4..718890a 100644 --- a/src/binsrv/event/footer.hpp +++ b/src/binsrv/events/footer.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_FOOTER_HPP -#define BINSRV_EVENT_FOOTER_HPP +#ifndef BINSRV_EVENTS_FOOTER_HPP +#define BINSRV_EVENTS_FOOTER_HPP -#include "binsrv/event/footer_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/footer_fwd.hpp" // IWYU pragma: export #include #include "util/byte_span_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { class [[nodiscard]] footer { public: @@ -36,6 +36,6 @@ class [[nodiscard]] footer { std::uint32_t crc_{}; }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_FOOTER_HPP +#endif // BINSRV_EVENTS_FOOTER_HPP diff --git a/src/binsrv/event/footer_fwd.hpp b/src/binsrv/events/footer_fwd.hpp similarity index 83% rename from src/binsrv/event/footer_fwd.hpp rename to src/binsrv/events/footer_fwd.hpp index 6a4d5ba..42e515e 100644 --- a/src/binsrv/event/footer_fwd.hpp +++ b/src/binsrv/events/footer_fwd.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_FOOTER_FWD_HPP -#define BINSRV_EVENT_FOOTER_FWD_HPP +#ifndef BINSRV_EVENTS_FOOTER_FWD_HPP +#define BINSRV_EVENTS_FOOTER_FWD_HPP #include -namespace binsrv::event { +namespace binsrv::events { class footer; std::ostream &operator<<(std::ostream &output, const footer &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_FOOTER_FWD_HPP +#endif // BINSRV_EVENTS_FOOTER_FWD_HPP diff --git a/src/binsrv/event/format_description_body_impl.cpp b/src/binsrv/events/format_description_body_impl.cpp similarity index 93% rename from src/binsrv/event/format_description_body_impl.cpp rename to src/binsrv/events/format_description_body_impl.cpp index 9792112..1216f27 100644 --- a/src/binsrv/event/format_description_body_impl.cpp +++ b/src/binsrv/events/format_description_body_impl.cpp @@ -13,7 +13,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/format_description_body_impl.hpp" +#include "binsrv/events/format_description_body_impl.hpp" #include #include @@ -23,15 +23,15 @@ #include -#include "binsrv/event/checksum_algorithm_type.hpp" -#include "binsrv/event/code_type.hpp" +#include "binsrv/events/checksum_algorithm_type.hpp" +#include "binsrv/events/code_type.hpp" #include "util/byte_span.hpp" #include "util/byte_span_extractors.hpp" #include "util/conversion_helpers.hpp" #include "util/exception_location_helpers.hpp" -namespace binsrv::event { +namespace binsrv::events { generic_body_impl::generic_body_impl( util::const_byte_span portion) { @@ -84,4 +84,4 @@ operator<<(std::ostream &output, << obj.get_readable_checksum_algorithm(); } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/format_description_body_impl.hpp b/src/binsrv/events/format_description_body_impl.hpp similarity index 81% rename from src/binsrv/event/format_description_body_impl.hpp rename to src/binsrv/events/format_description_body_impl.hpp index 7a211df..7d1ea48 100644 --- a/src/binsrv/event/format_description_body_impl.hpp +++ b/src/binsrv/events/format_description_body_impl.hpp @@ -13,21 +13,21 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_FORMAT_DESCRIPTION_BODY_IMPL_HPP -#define BINSRV_EVENT_FORMAT_DESCRIPTION_BODY_IMPL_HPP +#ifndef BINSRV_EVENTS_FORMAT_DESCRIPTION_BODY_IMPL_HPP +#define BINSRV_EVENTS_FORMAT_DESCRIPTION_BODY_IMPL_HPP -#include "binsrv/event/format_description_body_impl_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/format_description_body_impl_fwd.hpp" // IWYU pragma: export #include #include #include -#include "binsrv/event/checksum_algorithm_type_fwd.hpp" +#include "binsrv/events/checksum_algorithm_type_fwd.hpp" #include "util/byte_span_fwd.hpp" #include "util/conversion_helpers.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class [[nodiscard]] generic_body_impl { @@ -53,6 +53,6 @@ class [[nodiscard]] generic_body_impl { std::uint8_t checksum_algorithm_{}; }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_FORMAT_DESCRIPTION_BODY_IMPL_HPP +#endif // BINSRV_EVENTS_FORMAT_DESCRIPTION_BODY_IMPL_HPP diff --git a/src/binsrv/event/format_description_body_impl_fwd.hpp b/src/binsrv/events/format_description_body_impl_fwd.hpp similarity index 74% rename from src/binsrv/event/format_description_body_impl_fwd.hpp rename to src/binsrv/events/format_description_body_impl_fwd.hpp index fbf26fc..798d31c 100644 --- a/src/binsrv/event/format_description_body_impl_fwd.hpp +++ b/src/binsrv/events/format_description_body_impl_fwd.hpp @@ -13,15 +13,15 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_FORMAT_DESCRIPTION_BODY_IMPL_FWD_HPP -#define BINSRV_EVENT_FORMAT_DESCRIPTION_BODY_IMPL_FWD_HPP +#ifndef BINSRV_EVENTS_FORMAT_DESCRIPTION_BODY_IMPL_FWD_HPP +#define BINSRV_EVENTS_FORMAT_DESCRIPTION_BODY_IMPL_FWD_HPP #include -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_body_fwd.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_body_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class generic_body_impl; @@ -29,6 +29,6 @@ std::ostream & operator<<(std::ostream &output, const generic_body_impl &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_FORMAT_DESCRIPTION_BODY_IMPL_FWD_HPP +#endif // BINSRV_EVENTS_FORMAT_DESCRIPTION_BODY_IMPL_FWD_HPP diff --git a/src/binsrv/event/format_description_post_header_impl.cpp b/src/binsrv/events/format_description_post_header_impl.cpp similarity index 96% rename from src/binsrv/event/format_description_post_header_impl.cpp rename to src/binsrv/events/format_description_post_header_impl.cpp index e35cc9d..046af07 100644 --- a/src/binsrv/event/format_description_post_header_impl.cpp +++ b/src/binsrv/events/format_description_post_header_impl.cpp @@ -13,7 +13,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/format_description_post_header_impl.hpp" +#include "binsrv/events/format_description_post_header_impl.hpp" #include #include @@ -27,8 +27,8 @@ #include #include -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/protocol_traits.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/protocol_traits.hpp" #include "util/bounded_string_storage.hpp" #include "util/byte_span.hpp" @@ -36,7 +36,7 @@ #include "util/exception_location_helpers.hpp" #include "util/semantic_version.hpp" -namespace binsrv::event { +namespace binsrv::events { generic_post_header_impl:: generic_post_header_impl(std::uint32_t encoded_server_version, @@ -141,4 +141,4 @@ operator<<(std::ostream &output, return output; } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/format_description_post_header_impl.hpp b/src/binsrv/events/format_description_post_header_impl.hpp similarity index 89% rename from src/binsrv/event/format_description_post_header_impl.hpp rename to src/binsrv/events/format_description_post_header_impl.hpp index ffd3edc..e22b9b3 100644 --- a/src/binsrv/event/format_description_post_header_impl.hpp +++ b/src/binsrv/events/format_description_post_header_impl.hpp @@ -13,10 +13,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_FORMAT_DESCRIPTION_POST_HEADER_IMPL_HPP -#define BINSRV_EVENT_FORMAT_DESCRIPTION_POST_HEADER_IMPL_HPP +#ifndef BINSRV_EVENTS_FORMAT_DESCRIPTION_POST_HEADER_IMPL_HPP +#define BINSRV_EVENTS_FORMAT_DESCRIPTION_POST_HEADER_IMPL_HPP -#include "binsrv/event/format_description_post_header_impl_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/format_description_post_header_impl_fwd.hpp" // IWYU pragma: export #include #include @@ -25,12 +25,12 @@ #include #include -#include "binsrv/event/protocol_traits.hpp" +#include "binsrv/events/protocol_traits.hpp" #include "util/bounded_string_storage.hpp" #include "util/byte_span_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class [[nodiscard]] generic_post_header_impl { @@ -93,6 +93,6 @@ class [[nodiscard]] generic_post_header_impl { std::uint8_t common_header_length_{}; // 3 }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_FORMAT_DESCRIPTION_POST_HEADER_IMPL_HPP +#endif // BINSRV_EVENTS_FORMAT_DESCRIPTION_POST_HEADER_IMPL_HPP diff --git a/src/binsrv/event/format_description_post_header_impl_fwd.hpp b/src/binsrv/events/format_description_post_header_impl_fwd.hpp similarity index 73% rename from src/binsrv/event/format_description_post_header_impl_fwd.hpp rename to src/binsrv/events/format_description_post_header_impl_fwd.hpp index 8523413..5bf3b32 100644 --- a/src/binsrv/event/format_description_post_header_impl_fwd.hpp +++ b/src/binsrv/events/format_description_post_header_impl_fwd.hpp @@ -13,15 +13,15 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_FORMAT_DESCRIPTION_POST_HEADER_IMPL_FWD_HPP -#define BINSRV_EVENT_FORMAT_DESCRIPTION_POST_HEADER_IMPL_FWD_HPP +#ifndef BINSRV_EVENTS_FORMAT_DESCRIPTION_POST_HEADER_IMPL_FWD_HPP +#define BINSRV_EVENTS_FORMAT_DESCRIPTION_POST_HEADER_IMPL_FWD_HPP #include -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_post_header_fwd.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_post_header_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class generic_post_header_impl; @@ -29,6 +29,6 @@ std::ostream & operator<<(std::ostream &output, const generic_post_header_impl &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_FORMAT_DESCRIPTION_POST_HEADER_IMPL_FWD_HPP +#endif // BINSRV_EVENTS_FORMAT_DESCRIPTION_POST_HEADER_IMPL_FWD_HPP diff --git a/src/binsrv/event/generic_body.hpp b/src/binsrv/events/generic_body.hpp similarity index 87% rename from src/binsrv/event/generic_body.hpp rename to src/binsrv/events/generic_body.hpp index 3502e97..3e34ea9 100644 --- a/src/binsrv/event/generic_body.hpp +++ b/src/binsrv/events/generic_body.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GENERIC_BODY_HPP -#define BINSRV_EVENT_GENERIC_BODY_HPP +#ifndef BINSRV_EVENTS_GENERIC_BODY_HPP +#define BINSRV_EVENTS_GENERIC_BODY_HPP -#include "binsrv/event/generic_body_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/generic_body_fwd.hpp" // IWYU pragma: export -#include "binsrv/event/unknown_body_fwd.hpp" +#include "binsrv/events/unknown_body_fwd.hpp" #include "util/redirectable.hpp" -namespace binsrv::event { +namespace binsrv::events { // This class template is expected to be specialized for individual event type // codes. The specialization should be constructible from `const_byte_span`. @@ -59,6 +59,6 @@ struct generic_body_helper { template using generic_body = typename generic_body_helper::type; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GENERIC_BODY_HPP +#endif // BINSRV_EVENTS_GENERIC_BODY_HPP diff --git a/src/binsrv/event/generic_body_fwd.hpp b/src/binsrv/events/generic_body_fwd.hpp similarity index 77% rename from src/binsrv/event/generic_body_fwd.hpp rename to src/binsrv/events/generic_body_fwd.hpp index c7443ac..353663c 100644 --- a/src/binsrv/event/generic_body_fwd.hpp +++ b/src/binsrv/events/generic_body_fwd.hpp @@ -13,15 +13,15 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GENERIC_BODY_FWD_HPP -#define BINSRV_EVENT_GENERIC_BODY_FWD_HPP +#ifndef BINSRV_EVENTS_GENERIC_BODY_FWD_HPP +#define BINSRV_EVENTS_GENERIC_BODY_FWD_HPP -#include "binsrv/event/code_type_fwd.hpp" +#include "binsrv/events/code_type_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template class generic_body_impl; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GENERIC_BODY_FWD_HPP +#endif // BINSRV_EVENTS_GENERIC_BODY_FWD_HPP diff --git a/src/binsrv/event/generic_post_header.hpp b/src/binsrv/events/generic_post_header.hpp similarity index 86% rename from src/binsrv/event/generic_post_header.hpp rename to src/binsrv/events/generic_post_header.hpp index e3837bb..6aea857 100644 --- a/src/binsrv/event/generic_post_header.hpp +++ b/src/binsrv/events/generic_post_header.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GENERIC_POST_HEADER_HPP -#define BINSRV_EVENT_GENERIC_POST_HEADER_HPP +#ifndef BINSRV_EVENTS_GENERIC_POST_HEADER_HPP +#define BINSRV_EVENTS_GENERIC_POST_HEADER_HPP -#include "binsrv/event/generic_post_header_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/generic_post_header_fwd.hpp" // IWYU pragma: export -#include "binsrv/event/unknown_post_header_fwd.hpp" +#include "binsrv/events/unknown_post_header_fwd.hpp" #include "util/redirectable.hpp" -namespace binsrv::event { +namespace binsrv::events { // This class template is expected to be specialized for individual event type // codes. The specialization should be constructible from `const_byte_span`. @@ -59,6 +59,6 @@ struct generic_post_header_helper { template using generic_post_header = typename generic_post_header_helper::type; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GENERIC_POST_HEADER_HPP +#endif // BINSRV_EVENTS_GENERIC_POST_HEADER_HPP diff --git a/src/binsrv/event/generic_post_header_fwd.hpp b/src/binsrv/events/generic_post_header_fwd.hpp similarity index 75% rename from src/binsrv/event/generic_post_header_fwd.hpp rename to src/binsrv/events/generic_post_header_fwd.hpp index f2266bd..98d2a3f 100644 --- a/src/binsrv/event/generic_post_header_fwd.hpp +++ b/src/binsrv/events/generic_post_header_fwd.hpp @@ -13,15 +13,15 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GENERIC_POST_HEADER_FWD_HPP -#define BINSRV_EVENT_GENERIC_POST_HEADER_FWD_HPP +#ifndef BINSRV_EVENTS_GENERIC_POST_HEADER_FWD_HPP +#define BINSRV_EVENTS_GENERIC_POST_HEADER_FWD_HPP -#include "binsrv/event/code_type_fwd.hpp" +#include "binsrv/events/code_type_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template class generic_post_header_impl; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GENERIC_POST_HEADER_FWD_HPP +#endif // BINSRV_EVENTS_GENERIC_POST_HEADER_FWD_HPP diff --git a/src/binsrv/event/gtid_log_body.cpp b/src/binsrv/events/gtid_log_body.cpp similarity index 98% rename from src/binsrv/event/gtid_log_body.cpp rename to src/binsrv/events/gtid_log_body.cpp index 44dc89f..4dc8394 100644 --- a/src/binsrv/event/gtid_log_body.cpp +++ b/src/binsrv/events/gtid_log_body.cpp @@ -13,7 +13,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/gtid_log_body.hpp" +#include "binsrv/events/gtid_log_body.hpp" #include #include @@ -32,7 +32,7 @@ #include "util/exception_location_helpers.hpp" #include "util/semantic_version.hpp" -namespace binsrv::event { +namespace binsrv::events { gtid_log_body::gtid_log_body(util::const_byte_span portion) { // TODO: rework with direct member initialization @@ -159,4 +159,4 @@ std::ostream &operator<<(std::ostream &output, const gtid_log_body &obj) { return output; } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/gtid_log_body.hpp b/src/binsrv/events/gtid_log_body.hpp similarity index 94% rename from src/binsrv/event/gtid_log_body.hpp rename to src/binsrv/events/gtid_log_body.hpp index 05fb2ed..e94f545 100644 --- a/src/binsrv/event/gtid_log_body.hpp +++ b/src/binsrv/events/gtid_log_body.hpp @@ -13,10 +13,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GTID_LOG_BODY_HPP -#define BINSRV_EVENT_GTID_LOG_BODY_HPP +#ifndef BINSRV_EVENTS_GTID_LOG_BODY_HPP +#define BINSRV_EVENTS_GTID_LOG_BODY_HPP -#include "binsrv/event/gtid_log_body_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/gtid_log_body_fwd.hpp" // IWYU pragma: export #include #include @@ -28,7 +28,7 @@ #include "util/common_optional_types.hpp" #include "util/semantic_version_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { class [[nodiscard]] gtid_log_body { public: @@ -109,6 +109,6 @@ class [[nodiscard]] gtid_log_body { std::uint64_t commit_group_ticket_{unset_commit_group_ticket}; // 5 }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GTID_LOG_BODY_HPP +#endif // BINSRV_EVENTS_GTID_LOG_BODY_HPP diff --git a/src/binsrv/event/gtid_log_body_fwd.hpp b/src/binsrv/events/gtid_log_body_fwd.hpp similarity index 81% rename from src/binsrv/event/gtid_log_body_fwd.hpp rename to src/binsrv/events/gtid_log_body_fwd.hpp index ec5acea..7d177d2 100644 --- a/src/binsrv/event/gtid_log_body_fwd.hpp +++ b/src/binsrv/events/gtid_log_body_fwd.hpp @@ -13,17 +13,17 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GTID_LOG_BODY_FWD_HPP -#define BINSRV_EVENT_GTID_LOG_BODY_FWD_HPP +#ifndef BINSRV_EVENTS_GTID_LOG_BODY_FWD_HPP +#define BINSRV_EVENTS_GTID_LOG_BODY_FWD_HPP #include -namespace binsrv::event { +namespace binsrv::events { class gtid_log_body; std::ostream &operator<<(std::ostream &output, const gtid_log_body &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GTID_LOG_BODY_FWD_HPP +#endif // BINSRV_EVENTS_GTID_LOG_BODY_FWD_HPP diff --git a/src/binsrv/event/gtid_log_body_impl.hpp b/src/binsrv/events/gtid_log_body_impl.hpp similarity index 73% rename from src/binsrv/event/gtid_log_body_impl.hpp rename to src/binsrv/events/gtid_log_body_impl.hpp index d82765e..293dd28 100644 --- a/src/binsrv/event/gtid_log_body_impl.hpp +++ b/src/binsrv/events/gtid_log_body_impl.hpp @@ -13,20 +13,20 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GTID_LOG_BODY_IMPL_HPP -#define BINSRV_EVENT_GTID_LOG_BODY_IMPL_HPP +#ifndef BINSRV_EVENTS_GTID_LOG_BODY_IMPL_HPP +#define BINSRV_EVENTS_GTID_LOG_BODY_IMPL_HPP -#include "binsrv/event/gtid_log_body_impl_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/gtid_log_body_impl_fwd.hpp" // IWYU pragma: export -#include "binsrv/event/gtid_log_body.hpp" +#include "binsrv/events/gtid_log_body.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class [[nodiscard]] generic_body_impl { public: using redirect_type = gtid_log_body; }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GTID_LOG_BODY_IMPL_HPP +#endif // BINSRV_EVENTS_GTID_LOG_BODY_IMPL_HPP diff --git a/src/binsrv/event/gtid_log_body_impl_fwd.hpp b/src/binsrv/events/gtid_log_body_impl_fwd.hpp similarity index 73% rename from src/binsrv/event/gtid_log_body_impl_fwd.hpp rename to src/binsrv/events/gtid_log_body_impl_fwd.hpp index 1b09b5b..b0b1281 100644 --- a/src/binsrv/event/gtid_log_body_impl_fwd.hpp +++ b/src/binsrv/events/gtid_log_body_impl_fwd.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GTID_LOG_BODY_IMPL_FWD_HPP -#define BINSRV_EVENT_GTID_LOG_BODY_IMPL_FWD_HPP +#ifndef BINSRV_EVENTS_GTID_LOG_BODY_IMPL_FWD_HPP +#define BINSRV_EVENTS_GTID_LOG_BODY_IMPL_FWD_HPP -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_body_fwd.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_body_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class generic_body_impl; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GTID_LOG_BODY_IMPL_FWD_HPP +#endif // BINSRV_EVENTS_GTID_LOG_BODY_IMPL_FWD_HPP diff --git a/src/binsrv/event/gtid_log_flag_type.hpp b/src/binsrv/events/gtid_log_flag_type.hpp similarity index 73% rename from src/binsrv/event/gtid_log_flag_type.hpp rename to src/binsrv/events/gtid_log_flag_type.hpp index e1cda4f..426d493 100644 --- a/src/binsrv/event/gtid_log_flag_type.hpp +++ b/src/binsrv/events/gtid_log_flag_type.hpp @@ -13,10 +13,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GTID_LOG_FLAG_TYPE_HPP -#define BINSRV_EVENT_GTID_LOG_FLAG_TYPE_HPP +#ifndef BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_HPP +#define BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_HPP -#include "binsrv/event/gtid_log_flag_type_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/gtid_log_flag_type_fwd.hpp" // IWYU pragma: export #include #include @@ -25,7 +25,7 @@ #include "util/flag_set.hpp" -namespace binsrv::event { +namespace binsrv::events { // NOLINTBEGIN(cppcoreguidelines-macro-usage) // GTID_LOG event flags copied from @@ -36,34 +36,34 @@ namespace binsrv::event { // https://github.com/mysql/mysql-server/blob/mysql-8.4.6/libs/mysql/binlog/event/control_events.h#L1027 // 00000001 = Transaction may have changes logged with SBR // clang-format off -#define BINSRV_EVENT_GTID_LOG_FLAG_TYPE_XY_SEQUENCE() \ - BINSRV_EVENT_GTID_LOG_FLAG_TYPE_XY_MACRO(may_have_sbr, 0x01U) +#define BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_XY_SEQUENCE() \ + BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_XY_MACRO(may_have_sbr, 0x01U) // clang-format on -#define BINSRV_EVENT_GTID_LOG_FLAG_TYPE_XY_MACRO(X, Y) X = Y +#define BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_XY_MACRO(X, Y) X = Y // NOLINTNEXTLINE(readability-enum-initial-value,cert-int09-c) enum class gtid_log_flag_type : std::uint8_t { - BINSRV_EVENT_GTID_LOG_FLAG_TYPE_XY_SEQUENCE(), + BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_XY_SEQUENCE(), delimiter }; -#undef BINSRV_EVENT_GTID_LOG_FLAG_TYPE_XY_MACRO +#undef BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_XY_MACRO inline std::string_view to_string_view(gtid_log_flag_type code) noexcept { using namespace std::string_view_literals; using nv_pair = std::pair; -#define BINSRV_EVENT_GTID_LOG_FLAG_TYPE_XY_MACRO(X, Y) \ +#define BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_XY_MACRO(X, Y) \ nv_pair { gtid_log_flag_type::X, #X##sv } static constexpr std::array labels{ - BINSRV_EVENT_GTID_LOG_FLAG_TYPE_XY_SEQUENCE(), + BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_XY_SEQUENCE(), nv_pair{gtid_log_flag_type::delimiter, ""sv}}; -#undef BINSRV_EVENT_GTID_LOG_FLAG_TYPE_XY_MACRO +#undef BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_XY_MACRO // NOLINTNEXTLINE(llvm-qualified-auto,readability-qualified-auto) const auto fnd{std::ranges::find(labels, code, &nv_pair::first)}; return fnd == std::end(labels) ? ""sv : fnd->second; } -#undef BINSRV_EVENT_GTID_LOG_FLAG_TYPE_XY_SEQUENCE +#undef BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_XY_SEQUENCE // NOLINTEND(cppcoreguidelines-macro-usage) -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GTID_LOG_FLAG_TYPE_HPP +#endif // BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_HPP diff --git a/src/binsrv/event/gtid_log_flag_type_fwd.hpp b/src/binsrv/events/gtid_log_flag_type_fwd.hpp similarity index 82% rename from src/binsrv/event/gtid_log_flag_type_fwd.hpp rename to src/binsrv/events/gtid_log_flag_type_fwd.hpp index f78e5c2..411b9b7 100644 --- a/src/binsrv/event/gtid_log_flag_type_fwd.hpp +++ b/src/binsrv/events/gtid_log_flag_type_fwd.hpp @@ -13,20 +13,20 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GTID_LOG_FLAG_TYPE_FWD_HPP -#define BINSRV_EVENT_GTID_LOG_FLAG_TYPE_FWD_HPP +#ifndef BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_FWD_HPP +#define BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_FWD_HPP #include #include "util/flag_set_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { // NOLINTNEXTLINE(readability-enum-initial-value,cert-int09-c) enum class gtid_log_flag_type : std::uint8_t; using gtid_log_flag_set = util::flag_set; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GTID_LOG_FLAG_TYPE_FWD_HPP +#endif // BINSRV_EVENTS_GTID_LOG_FLAG_TYPE_FWD_HPP diff --git a/src/binsrv/event/gtid_log_post_header.cpp b/src/binsrv/events/gtid_log_post_header.cpp similarity index 97% rename from src/binsrv/event/gtid_log_post_header.cpp rename to src/binsrv/events/gtid_log_post_header.cpp index 63249ba..35d23e7 100644 --- a/src/binsrv/event/gtid_log_post_header.cpp +++ b/src/binsrv/events/gtid_log_post_header.cpp @@ -13,7 +13,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/gtid_log_post_header.hpp" +#include "binsrv/events/gtid_log_post_header.hpp" #include #include @@ -25,7 +25,7 @@ #include -#include "binsrv/event/gtid_log_flag_type.hpp" +#include "binsrv/events/gtid_log_flag_type.hpp" #include "binsrv/gtids/common_types.hpp" #include "binsrv/gtids/gtid.hpp" @@ -36,7 +36,7 @@ #include "util/exception_location_helpers.hpp" #include "util/flag_set.hpp" -namespace binsrv::event { +namespace binsrv::events { gtid_log_post_header::gtid_log_post_header(util::const_byte_span portion) { // TODO: rework with direct member initialization @@ -151,4 +151,4 @@ std::ostream &operator<<(std::ostream &output, << ", sequence_number: " << obj.get_sequence_number_raw(); } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/gtid_log_post_header.hpp b/src/binsrv/events/gtid_log_post_header.hpp similarity index 80% rename from src/binsrv/event/gtid_log_post_header.hpp rename to src/binsrv/events/gtid_log_post_header.hpp index cbbf02b..8eb437f 100644 --- a/src/binsrv/event/gtid_log_post_header.hpp +++ b/src/binsrv/events/gtid_log_post_header.hpp @@ -13,15 +13,15 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GTID_LOG_POST_HEADER_HPP -#define BINSRV_EVENT_GTID_LOG_POST_HEADER_HPP +#ifndef BINSRV_EVENTS_GTID_LOG_POST_HEADER_HPP +#define BINSRV_EVENTS_GTID_LOG_POST_HEADER_HPP -#include "binsrv/event/gtid_log_post_header_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/gtid_log_post_header_fwd.hpp" // IWYU pragma: export #include #include -#include "binsrv/event/gtid_log_flag_type_fwd.hpp" +#include "binsrv/events/gtid_log_flag_type_fwd.hpp" #include "binsrv/gtids/common_types.hpp" #include "binsrv/gtids/gtid_fwd.hpp" @@ -29,7 +29,7 @@ #include "util/byte_span_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { class [[nodiscard]] gtid_log_post_header { public: @@ -72,14 +72,14 @@ class [[nodiscard]] gtid_log_post_header { private: // the members are deliberately reordered for better packing - std::uint8_t flags_{}; // 0 - std::uint8_t logical_ts_code_{}; // 3 - gtids::uuid_storage uuid_{}; // 1 - std::int64_t gno_{}; // 2 - std::int64_t last_committed_{}; // 4 - std::int64_t sequence_number_{}; // 5 + std::uint8_t flags_{}; // 0 + std::uint8_t logical_ts_code_{}; // 3 + gtids::uuid_storage uuid_{}; // 1 + std::int64_t gno_{}; // 2 + std::int64_t last_committed_{}; // 4 + std::int64_t sequence_number_{}; // 5 }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GTID_LOG_POST_HEADER_HPP +#endif // BINSRV_EVENTS_GTID_LOG_POST_HEADER_HPP diff --git a/src/binsrv/event/gtid_log_post_header_fwd.hpp b/src/binsrv/events/gtid_log_post_header_fwd.hpp similarity index 80% rename from src/binsrv/event/gtid_log_post_header_fwd.hpp rename to src/binsrv/events/gtid_log_post_header_fwd.hpp index 7d035b6..2a5d82d 100644 --- a/src/binsrv/event/gtid_log_post_header_fwd.hpp +++ b/src/binsrv/events/gtid_log_post_header_fwd.hpp @@ -13,17 +13,17 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GTID_LOG_POST_HEADER_FWD_HPP -#define BINSRV_EVENT_GTID_LOG_POST_HEADER_FWD_HPP +#ifndef BINSRV_EVENTS_GTID_LOG_POST_HEADER_FWD_HPP +#define BINSRV_EVENTS_GTID_LOG_POST_HEADER_FWD_HPP #include -namespace binsrv::event { +namespace binsrv::events { class gtid_log_post_header; std::ostream &operator<<(std::ostream &output, const gtid_log_post_header &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GTID_LOG_POST_HEADER_FWD_HPP +#endif // BINSRV_EVENTS_GTID_LOG_POST_HEADER_FWD_HPP diff --git a/src/binsrv/event/gtid_log_post_header_impl.hpp b/src/binsrv/events/gtid_log_post_header_impl.hpp similarity index 71% rename from src/binsrv/event/gtid_log_post_header_impl.hpp rename to src/binsrv/events/gtid_log_post_header_impl.hpp index 6226760..df324be 100644 --- a/src/binsrv/event/gtid_log_post_header_impl.hpp +++ b/src/binsrv/events/gtid_log_post_header_impl.hpp @@ -13,20 +13,20 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GTID_LOG_POST_HEADER_IMPL_HPP -#define BINSRV_EVENT_GTID_LOG_POST_HEADER_IMPL_HPP +#ifndef BINSRV_EVENTS_GTID_LOG_POST_HEADER_IMPL_HPP +#define BINSRV_EVENTS_GTID_LOG_POST_HEADER_IMPL_HPP -#include "binsrv/event/gtid_log_post_header_impl_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/gtid_log_post_header_impl_fwd.hpp" // IWYU pragma: export -#include "binsrv/event/gtid_log_post_header.hpp" +#include "binsrv/events/gtid_log_post_header.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class [[nodiscard]] generic_post_header_impl { public: using redirect_type = gtid_log_post_header; }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GTID_LOG_POST_HEADER_IMPL_HPP +#endif // BINSRV_EVENTS_GTID_LOG_POST_HEADER_IMPL_HPP diff --git a/src/binsrv/event/gtid_log_post_header_impl_fwd.hpp b/src/binsrv/events/gtid_log_post_header_impl_fwd.hpp similarity index 71% rename from src/binsrv/event/gtid_log_post_header_impl_fwd.hpp rename to src/binsrv/events/gtid_log_post_header_impl_fwd.hpp index b98e3f8..81addbc 100644 --- a/src/binsrv/event/gtid_log_post_header_impl_fwd.hpp +++ b/src/binsrv/events/gtid_log_post_header_impl_fwd.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GTID_LOG_POST_HEADER_IMPL_FWD_HPP -#define BINSRV_EVENT_GTID_LOG_POST_HEADER_IMPL_FWD_HPP +#ifndef BINSRV_EVENTS_GTID_LOG_POST_HEADER_IMPL_FWD_HPP +#define BINSRV_EVENTS_GTID_LOG_POST_HEADER_IMPL_FWD_HPP -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_post_header_fwd.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_post_header_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class generic_post_header_impl; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GTID_LOG_POST_HEADER_IMPL_FWD_HPP +#endif // BINSRV_EVENTS_GTID_LOG_POST_HEADER_IMPL_FWD_HPP diff --git a/src/binsrv/event/gtid_tagged_log_body_impl.cpp b/src/binsrv/events/gtid_tagged_log_body_impl.cpp similarity index 98% rename from src/binsrv/event/gtid_tagged_log_body_impl.cpp rename to src/binsrv/events/gtid_tagged_log_body_impl.cpp index 1ee5137..7649da8 100644 --- a/src/binsrv/event/gtid_tagged_log_body_impl.cpp +++ b/src/binsrv/events/gtid_tagged_log_body_impl.cpp @@ -13,7 +13,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/gtid_tagged_log_body_impl.hpp" +#include "binsrv/events/gtid_tagged_log_body_impl.hpp" #include #include @@ -35,8 +35,8 @@ #include #include -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/gtid_log_flag_type.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/gtid_log_flag_type.hpp" #include "binsrv/gtids/gtid.hpp" #include "binsrv/gtids/tag.hpp" @@ -49,7 +49,7 @@ #include "util/flag_set.hpp" #include "util/semantic_version.hpp" -namespace binsrv::event { +namespace binsrv::events { generic_body_impl::generic_body_impl( util::const_byte_span portion) { @@ -344,4 +344,4 @@ void generic_body_impl::process_field_data( } } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/gtid_tagged_log_body_impl.hpp b/src/binsrv/events/gtid_tagged_log_body_impl.hpp similarity index 94% rename from src/binsrv/event/gtid_tagged_log_body_impl.hpp rename to src/binsrv/events/gtid_tagged_log_body_impl.hpp index ae62e3f..54dbb9d 100644 --- a/src/binsrv/event/gtid_tagged_log_body_impl.hpp +++ b/src/binsrv/events/gtid_tagged_log_body_impl.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GTID_TAGGED_LOG_BODY_IMPL_HPP -#define BINSRV_EVENT_GTID_TAGGED_LOG_BODY_IMPL_HPP +#ifndef BINSRV_EVENTS_GTID_TAGGED_LOG_BODY_IMPL_HPP +#define BINSRV_EVENTS_GTID_TAGGED_LOG_BODY_IMPL_HPP -#include "binsrv/event/gtid_tagged_log_body_impl_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/gtid_tagged_log_body_impl_fwd.hpp" // IWYU pragma: export #include #include #include -#include "binsrv/event/gtid_log_flag_type_fwd.hpp" +#include "binsrv/events/gtid_log_flag_type_fwd.hpp" #include "binsrv/gtids/common_types.hpp" #include "binsrv/gtids/gtid_fwd.hpp" @@ -33,7 +33,7 @@ #include "util/byte_span_fwd.hpp" #include "util/semantic_version_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class [[nodiscard]] generic_body_impl { public: @@ -157,6 +157,6 @@ template <> class [[nodiscard]] generic_body_impl { util::const_byte_span &remainder); }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GTID_TAGGED_LOG_BODY_IMPL_HPP +#endif // BINSRV_EVENTS_GTID_TAGGED_LOG_BODY_IMPL_HPP diff --git a/src/binsrv/event/gtid_tagged_log_body_impl_fwd.hpp b/src/binsrv/events/gtid_tagged_log_body_impl_fwd.hpp similarity index 74% rename from src/binsrv/event/gtid_tagged_log_body_impl_fwd.hpp rename to src/binsrv/events/gtid_tagged_log_body_impl_fwd.hpp index 0c0fb89..5bcfebf 100644 --- a/src/binsrv/event/gtid_tagged_log_body_impl_fwd.hpp +++ b/src/binsrv/events/gtid_tagged_log_body_impl_fwd.hpp @@ -13,13 +13,13 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GTID_TAGGED_LOG_BODY_IMPL_FWD_HPP -#define BINSRV_EVENT_GTID_TAGGED_LOG_BODY_IMPL_FWD_HPP +#ifndef BINSRV_EVENTS_GTID_TAGGED_LOG_BODY_IMPL_FWD_HPP +#define BINSRV_EVENTS_GTID_TAGGED_LOG_BODY_IMPL_FWD_HPP -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_body_fwd.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_body_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class generic_body_impl; @@ -27,6 +27,6 @@ std::ostream & operator<<(std::ostream &output, const generic_body_impl &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GTID_TAGGED_LOG_BODY_IMPL_FWD_HPP +#endif // BINSRV_EVENTS_GTID_TAGGED_LOG_BODY_IMPL_FWD_HPP diff --git a/src/binsrv/event/gtid_tagged_log_post_header_impl.hpp b/src/binsrv/events/gtid_tagged_log_post_header_impl.hpp similarity index 70% rename from src/binsrv/event/gtid_tagged_log_post_header_impl.hpp rename to src/binsrv/events/gtid_tagged_log_post_header_impl.hpp index ec403eb..9ee87e0 100644 --- a/src/binsrv/event/gtid_tagged_log_post_header_impl.hpp +++ b/src/binsrv/events/gtid_tagged_log_post_header_impl.hpp @@ -13,14 +13,14 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GTID_TAGGED_LOG_POST_HEADER_IMPL_HPP -#define BINSRV_EVENT_GTID_TAGGED_LOG_POST_HEADER_IMPL_HPP +#ifndef BINSRV_EVENTS_GTID_TAGGED_LOG_POST_HEADER_IMPL_HPP +#define BINSRV_EVENTS_GTID_TAGGED_LOG_POST_HEADER_IMPL_HPP -#include "binsrv/event/gtid_tagged_log_post_header_impl_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/gtid_tagged_log_post_header_impl_fwd.hpp" // IWYU pragma: export -#include "binsrv/event/empty_post_header.hpp" +#include "binsrv/events/empty_post_header.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class [[nodiscard]] generic_post_header_impl { @@ -28,6 +28,6 @@ class [[nodiscard]] generic_post_header_impl { using redirect_type = empty_post_header; }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GTID_TAGGED_LOG_POST_HEADER_IMPL_HPP +#endif // BINSRV_EVENTS_GTID_TAGGED_LOG_POST_HEADER_IMPL_HPP diff --git a/src/binsrv/event/gtid_tagged_log_post_header_impl_fwd.hpp b/src/binsrv/events/gtid_tagged_log_post_header_impl_fwd.hpp similarity index 70% rename from src/binsrv/event/gtid_tagged_log_post_header_impl_fwd.hpp rename to src/binsrv/events/gtid_tagged_log_post_header_impl_fwd.hpp index c06b7a4..70c67f8 100644 --- a/src/binsrv/event/gtid_tagged_log_post_header_impl_fwd.hpp +++ b/src/binsrv/events/gtid_tagged_log_post_header_impl_fwd.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_GTID_TAGGED_LOG_POST_HEADER_IMPL_FWD_HPP -#define BINSRV_EVENT_GTID_TAGGED_LOG_POST_HEADER_IMPL_FWD_HPP +#ifndef BINSRV_EVENTS_GTID_TAGGED_LOG_POST_HEADER_IMPL_FWD_HPP +#define BINSRV_EVENTS_GTID_TAGGED_LOG_POST_HEADER_IMPL_FWD_HPP -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_post_header_fwd.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_post_header_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class generic_post_header_impl; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_GTID_TAGGED_LOG_POST_HEADER_IMPL_FWD_HPP +#endif // BINSRV_EVENTS_GTID_TAGGED_LOG_POST_HEADER_IMPL_FWD_HPP diff --git a/src/binsrv/event/previous_gtids_log_body_impl.cpp b/src/binsrv/events/previous_gtids_log_body_impl.cpp similarity index 92% rename from src/binsrv/event/previous_gtids_log_body_impl.cpp rename to src/binsrv/events/previous_gtids_log_body_impl.cpp index 15b7dcf..8053ad2 100644 --- a/src/binsrv/event/previous_gtids_log_body_impl.cpp +++ b/src/binsrv/events/previous_gtids_log_body_impl.cpp @@ -13,7 +13,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/previous_gtids_log_body_impl.hpp" +#include "binsrv/events/previous_gtids_log_body_impl.hpp" #include #include @@ -23,7 +23,7 @@ #include -#include "binsrv/event/code_type.hpp" +#include "binsrv/events/code_type.hpp" #include "binsrv/gtids/common_types.hpp" #include "binsrv/gtids/gtid_set.hpp" @@ -31,7 +31,7 @@ #include "util/byte_span.hpp" #include "util/byte_span_extractors.hpp" -namespace binsrv::event { +namespace binsrv::events { generic_body_impl::generic_body_impl( util::const_byte_span portion) { @@ -60,4 +60,4 @@ operator<<(std::ostream &output, return output << "gtid_set: " << obj.get_readable_gtids(); } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/previous_gtids_log_body_impl.hpp b/src/binsrv/events/previous_gtids_log_body_impl.hpp similarity index 82% rename from src/binsrv/event/previous_gtids_log_body_impl.hpp rename to src/binsrv/events/previous_gtids_log_body_impl.hpp index 2c8fa49..fd1fee3 100644 --- a/src/binsrv/event/previous_gtids_log_body_impl.hpp +++ b/src/binsrv/events/previous_gtids_log_body_impl.hpp @@ -13,10 +13,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_PREVIOUS_GTIDS_LOG_BODY_IMPL_HPP -#define BINSRV_EVENT_PREVIOUS_GTIDS_LOG_BODY_IMPL_HPP +#ifndef BINSRV_EVENTS_PREVIOUS_GTIDS_LOG_BODY_IMPL_HPP +#define BINSRV_EVENTS_PREVIOUS_GTIDS_LOG_BODY_IMPL_HPP -#include "binsrv/event/previous_gtids_log_body_impl_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/previous_gtids_log_body_impl_fwd.hpp" // IWYU pragma: export #include #include @@ -28,7 +28,7 @@ #include "util/byte_span_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class [[nodiscard]] generic_body_impl { @@ -47,6 +47,6 @@ class [[nodiscard]] generic_body_impl { gtids::gtid_set_storage gtids_; }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_PREVIOUS_GTIDS_LOG_BODY_IMPL_HPP +#endif // BINSRV_EVENTS_PREVIOUS_GTIDS_LOG_BODY_IMPL_HPP diff --git a/src/binsrv/event/previous_gtids_log_body_impl_fwd.hpp b/src/binsrv/events/previous_gtids_log_body_impl_fwd.hpp similarity index 74% rename from src/binsrv/event/previous_gtids_log_body_impl_fwd.hpp rename to src/binsrv/events/previous_gtids_log_body_impl_fwd.hpp index a8fc8eb..70ef911 100644 --- a/src/binsrv/event/previous_gtids_log_body_impl_fwd.hpp +++ b/src/binsrv/events/previous_gtids_log_body_impl_fwd.hpp @@ -13,13 +13,13 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_PREVIOUS_GTIDS_LOG_BODY_IMPL_FWD_HPP -#define BINSRV_EVENT_PREVIOUS_GTIDS_LOG_BODY_IMPL_FWD_HPP +#ifndef BINSRV_EVENTS_PREVIOUS_GTIDS_LOG_BODY_IMPL_FWD_HPP +#define BINSRV_EVENTS_PREVIOUS_GTIDS_LOG_BODY_IMPL_FWD_HPP -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_body_fwd.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_body_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class generic_body_impl; @@ -27,6 +27,6 @@ std::ostream & operator<<(std::ostream &output, const generic_body_impl &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_PREVIOUS_GTIDS_LOG_BODY_IMPL_FWD_HPP +#endif // BINSRV_EVENTS_PREVIOUS_GTIDS_LOG_BODY_IMPL_FWD_HPP diff --git a/src/binsrv/event/previous_gtids_log_post_header_impl.hpp b/src/binsrv/events/previous_gtids_log_post_header_impl.hpp similarity index 69% rename from src/binsrv/event/previous_gtids_log_post_header_impl.hpp rename to src/binsrv/events/previous_gtids_log_post_header_impl.hpp index 4b5d61e..9e704fa 100644 --- a/src/binsrv/event/previous_gtids_log_post_header_impl.hpp +++ b/src/binsrv/events/previous_gtids_log_post_header_impl.hpp @@ -13,14 +13,14 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_PRESIOUS_GTIDS_LOG_POST_HEADER_IMPL_HPP -#define BINSRV_EVENT_PRESIOUS_GTIDS_LOG_POST_HEADER_IMPL_HPP +#ifndef BINSRV_EVENTS_PRESIOUS_GTIDS_LOG_POST_HEADER_IMPL_HPP +#define BINSRV_EVENTS_PRESIOUS_GTIDS_LOG_POST_HEADER_IMPL_HPP -#include "binsrv/event/previous_gtids_log_post_header_impl_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/previous_gtids_log_post_header_impl_fwd.hpp" // IWYU pragma: export -#include "binsrv/event/empty_post_header.hpp" +#include "binsrv/events/empty_post_header.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class [[nodiscard]] generic_post_header_impl { @@ -28,6 +28,6 @@ class [[nodiscard]] generic_post_header_impl { using redirect_type = empty_post_header; }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_PRESIOUS_GTIDS_LOG_POST_HEADER_IMPL_HPP +#endif // BINSRV_EVENTS_PRESIOUS_GTIDS_LOG_POST_HEADER_IMPL_HPP diff --git a/src/binsrv/event/previous_gtids_log_post_header_impl_fwd.hpp b/src/binsrv/events/previous_gtids_log_post_header_impl_fwd.hpp similarity index 69% rename from src/binsrv/event/previous_gtids_log_post_header_impl_fwd.hpp rename to src/binsrv/events/previous_gtids_log_post_header_impl_fwd.hpp index 91135cb..80118bf 100644 --- a/src/binsrv/event/previous_gtids_log_post_header_impl_fwd.hpp +++ b/src/binsrv/events/previous_gtids_log_post_header_impl_fwd.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_PREVIOUS_GTIDS_LOG_POST_HEADER_IMPL_FWD_HPP -#define BINSRV_EVENT_PREVIOUS_GTIDS_LOG_POST_HEADER_IMPL_FWD_HPP +#ifndef BINSRV_EVENTS_PREVIOUS_GTIDS_LOG_POST_HEADER_IMPL_FWD_HPP +#define BINSRV_EVENTS_PREVIOUS_GTIDS_LOG_POST_HEADER_IMPL_FWD_HPP -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_post_header_fwd.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_post_header_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class generic_post_header_impl; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_PREVIOUS_GTIDS_LOG_POST_HEADER_IMPL_FWD_HPP +#endif // BINSRV_EVENTS_PREVIOUS_GTIDS_LOG_POST_HEADER_IMPL_FWD_HPP diff --git a/src/binsrv/event/protocol_traits.cpp b/src/binsrv/events/protocol_traits.cpp similarity index 96% rename from src/binsrv/event/protocol_traits.cpp rename to src/binsrv/events/protocol_traits.cpp index ce6ecea..098bebd 100644 --- a/src/binsrv/event/protocol_traits.cpp +++ b/src/binsrv/events/protocol_traits.cpp @@ -13,7 +13,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/protocol_traits.hpp" +#include "binsrv/events/protocol_traits.hpp" #include #include @@ -28,12 +28,12 @@ #include -#include "binsrv/event/code_type.hpp" +#include "binsrv/events/code_type.hpp" #include "util/conversion_helpers.hpp" #include "util/exception_location_helpers.hpp" -namespace binsrv::event { +namespace binsrv::events { [[nodiscard]] std::size_t get_post_header_length_for_code(std::uint32_t encoded_server_version, @@ -112,4 +112,4 @@ void validate_post_header_lengths( } } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/protocol_traits.hpp b/src/binsrv/events/protocol_traits.hpp similarity index 84% rename from src/binsrv/event/protocol_traits.hpp rename to src/binsrv/events/protocol_traits.hpp index 3e458a6..cdb6f32 100644 --- a/src/binsrv/event/protocol_traits.hpp +++ b/src/binsrv/events/protocol_traits.hpp @@ -13,18 +13,18 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_PROTOCOL_TRAITS_HPP -#define BINSRV_EVENT_PROTOCOL_TRAITS_HPP +#ifndef BINSRV_EVENTS_PROTOCOL_TRAITS_HPP +#define BINSRV_EVENTS_PROTOCOL_TRAITS_HPP -#include "binsrv/event/protocol_traits_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/protocol_traits_fwd.hpp" // IWYU pragma: export #include #include #include -#include "binsrv/event/code_type_fwd.hpp" +#include "binsrv/events/code_type_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { using encoded_post_header_length_type = std::uint8_t; @@ -47,6 +47,6 @@ void validate_post_header_lengths( const post_header_length_container &runtime, const post_header_length_container &hardcoded); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_PROTOCOL_TRAITS_HPP +#endif // BINSRV_EVENTS_PROTOCOL_TRAITS_HPP diff --git a/src/binsrv/event/protocol_traits_fwd.hpp b/src/binsrv/events/protocol_traits_fwd.hpp similarity index 93% rename from src/binsrv/event/protocol_traits_fwd.hpp rename to src/binsrv/events/protocol_traits_fwd.hpp index 61f0018..d24b3c1 100644 --- a/src/binsrv/event/protocol_traits_fwd.hpp +++ b/src/binsrv/events/protocol_traits_fwd.hpp @@ -13,8 +13,8 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_PROTOCOL_TRAITS_FWD_HPP -#define BINSRV_EVENT_PROTOCOL_TRAITS_FWD_HPP +#ifndef BINSRV_EVENTS_PROTOCOL_TRAITS_FWD_HPP +#define BINSRV_EVENTS_PROTOCOL_TRAITS_FWD_HPP #include #include @@ -23,7 +23,7 @@ #include #include -namespace binsrv::event { +namespace binsrv::events { inline constexpr std::uint16_t default_binlog_version{4U}; @@ -65,6 +65,6 @@ inline constexpr std::array magic_binlog_payload{ std::byte{0xFE}, std::byte{0x62}, std::byte{0x69}, std::byte{0x6E}}; inline constexpr std::uint64_t magic_binlog_offset{4ULL}; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_PROTOCOL_TRAITS_FWD_HPP +#endif // BINSRV_EVENTS_PROTOCOL_TRAITS_FWD_HPP diff --git a/src/binsrv/event/reader_context.cpp b/src/binsrv/events/reader_context.cpp similarity index 97% rename from src/binsrv/event/reader_context.cpp rename to src/binsrv/events/reader_context.cpp index ba1db9b..0b8fa3d 100644 --- a/src/binsrv/event/reader_context.cpp +++ b/src/binsrv/events/reader_context.cpp @@ -13,7 +13,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/reader_context.hpp" +#include "binsrv/events/reader_context.hpp" #include #include @@ -25,15 +25,15 @@ #include "binsrv/replication_mode_type.hpp" -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/common_header_flag_type.hpp" -#include "binsrv/event/event.hpp" -#include "binsrv/event/protocol_traits.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/common_header_flag_type.hpp" +#include "binsrv/events/event.hpp" +#include "binsrv/events/protocol_traits.hpp" #include "util/conversion_helpers.hpp" #include "util/exception_location_helpers.hpp" -namespace binsrv::event { +namespace binsrv::events { reader_context::reader_context(std::uint32_t encoded_server_version, bool verify_checksum, @@ -506,14 +506,14 @@ void reader_context::start_transaction(const event ¤t_event) { case code_type::anonymous_gtid_log: { // no need to update transaction_gtid_ as in anonymous gtid log event // the gtid part is expected to be empty - if (!current_event.get_post_header() + if (!current_event.get_post_header() .get_gtid() .is_empty()) { util::exception_location().raise( "encountered non-empty gtid in the anonymous gtid log event"); } const auto expected_transaction_length_raw{ - current_event.get_body() + current_event.get_body() .get_transaction_length_raw()}; if (!std::in_range(expected_transaction_length_raw)) { util::exception_location().raise( @@ -524,14 +524,14 @@ void reader_context::start_transaction(const event ¤t_event) { } break; case code_type::gtid_log: { transaction_gtid_ = - current_event.get_post_header() + current_event.get_post_header() .get_gtid(); if (transaction_gtid_.is_empty()) { util::exception_location().raise( "encountered an empty gtid in the gtid log event"); } const auto expected_transaction_length_raw{ - current_event.get_body() + current_event.get_body() .get_transaction_length_raw()}; if (!std::in_range(expected_transaction_length_raw)) { util::exception_location().raise( @@ -542,7 +542,7 @@ void reader_context::start_transaction(const event ¤t_event) { } break; case code_type::gtid_tagged_log: { const auto >id_tagged_log_body{ - current_event.get_body()}; + current_event.get_body()}; transaction_gtid_ = gtid_tagged_log_body.get_gtid(); if (transaction_gtid_.is_empty()) { util::exception_location().raise( @@ -641,4 +641,4 @@ reader_context::get_hardcoded_post_header_lengths( : latest_known_post_header_lengths; } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/reader_context.hpp b/src/binsrv/events/reader_context.hpp similarity index 91% rename from src/binsrv/event/reader_context.hpp rename to src/binsrv/events/reader_context.hpp index 002e186..94d1270 100644 --- a/src/binsrv/event/reader_context.hpp +++ b/src/binsrv/events/reader_context.hpp @@ -13,10 +13,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_READER_CONTEXT_HPP -#define BINSRV_EVENT_READER_CONTEXT_HPP +#ifndef BINSRV_EVENTS_READER_CONTEXT_HPP +#define BINSRV_EVENTS_READER_CONTEXT_HPP -#include "binsrv/event/reader_context_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/reader_context_fwd.hpp" // IWYU pragma: export #include @@ -24,11 +24,11 @@ #include "binsrv/gtids/gtid.hpp" -#include "binsrv/event/common_header_fwd.hpp" -#include "binsrv/event/event_fwd.hpp" -#include "binsrv/event/protocol_traits.hpp" +#include "binsrv/events/common_header_fwd.hpp" +#include "binsrv/events/event_fwd.hpp" +#include "binsrv/events/protocol_traits.hpp" -namespace binsrv::event { +namespace binsrv::events { class [[nodiscard]] reader_context { friend class event; @@ -124,6 +124,6 @@ class [[nodiscard]] reader_context { std::uint32_t encoded_server_version) noexcept; }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_READER_CONTEXT_HPP +#endif // BINSRV_EVENTS_READER_CONTEXT_HPP diff --git a/src/binsrv/event/reader_context_fwd.hpp b/src/binsrv/events/reader_context_fwd.hpp similarity index 79% rename from src/binsrv/event/reader_context_fwd.hpp rename to src/binsrv/events/reader_context_fwd.hpp index 12047c2..aa1b090 100644 --- a/src/binsrv/event/reader_context_fwd.hpp +++ b/src/binsrv/events/reader_context_fwd.hpp @@ -13,13 +13,13 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_READER_CONTEXT_FWD_HPP -#define BINSRV_EVENT_READER_CONTEXT_FWD_HPP +#ifndef BINSRV_EVENTS_READER_CONTEXT_FWD_HPP +#define BINSRV_EVENTS_READER_CONTEXT_FWD_HPP -namespace binsrv::event { +namespace binsrv::events { class reader_context; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_READER_CONTEXT_FWD_HPP +#endif // BINSRV_EVENTS_READER_CONTEXT_FWD_HPP diff --git a/src/binsrv/event/rotate_body_impl.cpp b/src/binsrv/events/rotate_body_impl.cpp similarity index 90% rename from src/binsrv/event/rotate_body_impl.cpp rename to src/binsrv/events/rotate_body_impl.cpp index 8848b26..9329792 100644 --- a/src/binsrv/event/rotate_body_impl.cpp +++ b/src/binsrv/events/rotate_body_impl.cpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/rotate_body_impl.hpp" +#include "binsrv/events/rotate_body_impl.hpp" #include #include -#include "binsrv/event/code_type.hpp" +#include "binsrv/events/code_type.hpp" #include "util/byte_span.hpp" -namespace binsrv::event { +namespace binsrv::events { generic_body_impl::generic_body_impl( util::const_byte_span portion) { @@ -39,4 +39,4 @@ std::ostream &operator<<(std::ostream &output, return output << "binlog: " << obj.get_binlog(); } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/rotate_body_impl.hpp b/src/binsrv/events/rotate_body_impl.hpp similarity index 85% rename from src/binsrv/event/rotate_body_impl.hpp rename to src/binsrv/events/rotate_body_impl.hpp index 9696f91..cb8b23a 100644 --- a/src/binsrv/event/rotate_body_impl.hpp +++ b/src/binsrv/events/rotate_body_impl.hpp @@ -13,10 +13,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_ROTATE_BODY_IMPL_HPP -#define BINSRV_EVENT_ROTATE_BODY_IMPL_HPP +#ifndef BINSRV_EVENTS_ROTATE_BODY_IMPL_HPP +#define BINSRV_EVENTS_ROTATE_BODY_IMPL_HPP -#include "binsrv/event/rotate_body_impl_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/rotate_body_impl_fwd.hpp" // IWYU pragma: export #include #include @@ -25,7 +25,7 @@ #include "util/byte_span.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class [[nodiscard]] generic_body_impl { public: @@ -49,6 +49,6 @@ template <> class [[nodiscard]] generic_body_impl { binlog_storage binlog_{}; }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_ROTATE_BODY_IMPL_HPP +#endif // BINSRV_EVENTS_ROTATE_BODY_IMPL_HPP diff --git a/src/binsrv/event/rotate_body_impl_fwd.hpp b/src/binsrv/events/rotate_body_impl_fwd.hpp similarity index 76% rename from src/binsrv/event/rotate_body_impl_fwd.hpp rename to src/binsrv/events/rotate_body_impl_fwd.hpp index 154afc1..565f663 100644 --- a/src/binsrv/event/rotate_body_impl_fwd.hpp +++ b/src/binsrv/events/rotate_body_impl_fwd.hpp @@ -13,21 +13,21 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_ROTATE_BODY_IMPL_FWD_HPP -#define BINSRV_EVENT_ROTATE_BODY_IMPL_FWD_HPP +#ifndef BINSRV_EVENTS_ROTATE_BODY_IMPL_FWD_HPP +#define BINSRV_EVENTS_ROTATE_BODY_IMPL_FWD_HPP #include -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_body_fwd.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_body_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class generic_body_impl; std::ostream &operator<<(std::ostream &output, const generic_body_impl &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_ROTATE_BODY_IMPL_FWD_HPP +#endif // BINSRV_EVENTS_ROTATE_BODY_IMPL_FWD_HPP diff --git a/src/binsrv/event/rotate_post_header_impl.cpp b/src/binsrv/events/rotate_post_header_impl.cpp similarity index 94% rename from src/binsrv/event/rotate_post_header_impl.cpp rename to src/binsrv/events/rotate_post_header_impl.cpp index 4677611..f431e9e 100644 --- a/src/binsrv/event/rotate_post_header_impl.cpp +++ b/src/binsrv/events/rotate_post_header_impl.cpp @@ -13,7 +13,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/rotate_post_header_impl.hpp" +#include "binsrv/events/rotate_post_header_impl.hpp" #include #include @@ -21,13 +21,13 @@ #include -#include "binsrv/event/code_type.hpp" +#include "binsrv/events/code_type.hpp" #include "util/byte_span.hpp" #include "util/byte_span_extractors.hpp" #include "util/exception_location_helpers.hpp" -namespace binsrv::event { +namespace binsrv::events { generic_post_header_impl::generic_post_header_impl( util::const_byte_span portion) { @@ -80,4 +80,4 @@ operator<<(std::ostream &output, return output << "position: " << obj.get_position_raw(); } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/rotate_post_header_impl.hpp b/src/binsrv/events/rotate_post_header_impl.hpp similarity index 79% rename from src/binsrv/event/rotate_post_header_impl.hpp rename to src/binsrv/events/rotate_post_header_impl.hpp index 17da7e3..4bd8239 100644 --- a/src/binsrv/event/rotate_post_header_impl.hpp +++ b/src/binsrv/events/rotate_post_header_impl.hpp @@ -13,17 +13,17 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_ROTATE_POST_HEADER_IMPL_HPP -#define BINSRV_EVENT_ROTATE_POST_HEADER_IMPL_HPP +#ifndef BINSRV_EVENTS_ROTATE_POST_HEADER_IMPL_HPP +#define BINSRV_EVENTS_ROTATE_POST_HEADER_IMPL_HPP -#include "binsrv/event/rotate_post_header_impl_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/rotate_post_header_impl_fwd.hpp" // IWYU pragma: export #include #include #include "util/byte_span_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class [[nodiscard]] generic_post_header_impl { public: @@ -39,6 +39,6 @@ template <> class [[nodiscard]] generic_post_header_impl { std::uint64_t position_{}; }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_ROTATE_POST_HEADER_IMPL_HPP +#endif // BINSRV_EVENTS_ROTATE_POST_HEADER_IMPL_HPP diff --git a/src/binsrv/event/rotate_post_header_impl_fwd.hpp b/src/binsrv/events/rotate_post_header_impl_fwd.hpp similarity index 74% rename from src/binsrv/event/rotate_post_header_impl_fwd.hpp rename to src/binsrv/events/rotate_post_header_impl_fwd.hpp index f42bd91..099d3b4 100644 --- a/src/binsrv/event/rotate_post_header_impl_fwd.hpp +++ b/src/binsrv/events/rotate_post_header_impl_fwd.hpp @@ -13,15 +13,15 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_ROTATE_POST_HEADER_IMPL_FWD_HPP -#define BINSRV_EVENT_ROTATE_POST_HEADER_IMPL_FWD_HPP +#ifndef BINSRV_EVENTS_ROTATE_POST_HEADER_IMPL_FWD_HPP +#define BINSRV_EVENTS_ROTATE_POST_HEADER_IMPL_FWD_HPP #include -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_post_header_fwd.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_post_header_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class generic_post_header_impl; @@ -29,6 +29,6 @@ std::ostream & operator<<(std::ostream &output, const generic_post_header_impl &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_ROTATE_POST_HEADER_IMPL_FWD_HPP +#endif // BINSRV_EVENTS_ROTATE_POST_HEADER_IMPL_FWD_HPP diff --git a/src/binsrv/event/stop_body_impl.hpp b/src/binsrv/events/stop_body_impl.hpp similarity index 74% rename from src/binsrv/event/stop_body_impl.hpp rename to src/binsrv/events/stop_body_impl.hpp index 74bf94e..5d2dfb0 100644 --- a/src/binsrv/event/stop_body_impl.hpp +++ b/src/binsrv/events/stop_body_impl.hpp @@ -13,20 +13,20 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_STOP_BODY_IMPL_HPP -#define BINSRV_EVENT_STOP_BODY_IMPL_HPP +#ifndef BINSRV_EVENTS_STOP_BODY_IMPL_HPP +#define BINSRV_EVENTS_STOP_BODY_IMPL_HPP -#include "binsrv/event/stop_body_impl_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/stop_body_impl_fwd.hpp" // IWYU pragma: export -#include "binsrv/event/empty_body.hpp" +#include "binsrv/events/empty_body.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class [[nodiscard]] generic_body_impl { public: using redirect_type = empty_body; }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_STOP_BODY_IMPL_HPP +#endif // BINSRV_EVENTS_STOP_BODY_IMPL_HPP diff --git a/src/binsrv/event/stop_body_impl_fwd.hpp b/src/binsrv/events/stop_body_impl_fwd.hpp similarity index 73% rename from src/binsrv/event/stop_body_impl_fwd.hpp rename to src/binsrv/events/stop_body_impl_fwd.hpp index d9eba97..7e82f3c 100644 --- a/src/binsrv/event/stop_body_impl_fwd.hpp +++ b/src/binsrv/events/stop_body_impl_fwd.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_STOP_BODY_IMPL_FWD_HPP -#define BINSRV_EVENT_STOP_BODY_IMPL_FWD_HPP +#ifndef BINSRV_EVENTS_STOP_BODY_IMPL_FWD_HPP +#define BINSRV_EVENTS_STOP_BODY_IMPL_FWD_HPP -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_body_fwd.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_body_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class generic_body_impl; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_STOP_BODY_IMPL_FWD_HPP +#endif // BINSRV_EVENTS_STOP_BODY_IMPL_FWD_HPP diff --git a/src/binsrv/event/stop_post_header_impl.hpp b/src/binsrv/events/stop_post_header_impl.hpp similarity index 72% rename from src/binsrv/event/stop_post_header_impl.hpp rename to src/binsrv/events/stop_post_header_impl.hpp index 5b628ee..71b294c 100644 --- a/src/binsrv/event/stop_post_header_impl.hpp +++ b/src/binsrv/events/stop_post_header_impl.hpp @@ -13,20 +13,20 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_STOP_POST_HEADER_IMPL_HPP -#define BINSRV_EVENT_STOP_POST_HEADER_IMPL_HPP +#ifndef BINSRV_EVENTS_STOP_POST_HEADER_IMPL_HPP +#define BINSRV_EVENTS_STOP_POST_HEADER_IMPL_HPP -#include "binsrv/event/stop_post_header_impl_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/stop_post_header_impl_fwd.hpp" // IWYU pragma: export -#include "binsrv/event/empty_post_header.hpp" +#include "binsrv/events/empty_post_header.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class [[nodiscard]] generic_post_header_impl { public: using redirect_type = empty_post_header; }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_STOP_POST_HEADER_IMPL_HPP +#endif // BINSRV_EVENTS_STOP_POST_HEADER_IMPL_HPP diff --git a/src/binsrv/event/stop_post_header_impl_fwd.hpp b/src/binsrv/events/stop_post_header_impl_fwd.hpp similarity index 72% rename from src/binsrv/event/stop_post_header_impl_fwd.hpp rename to src/binsrv/events/stop_post_header_impl_fwd.hpp index 085082a..c8c5f00 100644 --- a/src/binsrv/event/stop_post_header_impl_fwd.hpp +++ b/src/binsrv/events/stop_post_header_impl_fwd.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_STOP_POST_HEADER_IMPL_FWD_HPP -#define BINSRV_EVENT_STOP_POST_HEADER_IMPL_FWD_HPP +#ifndef BINSRV_EVENTS_STOP_POST_HEADER_IMPL_FWD_HPP +#define BINSRV_EVENTS_STOP_POST_HEADER_IMPL_FWD_HPP -#include "binsrv/event/code_type.hpp" -#include "binsrv/event/generic_post_header_fwd.hpp" +#include "binsrv/events/code_type.hpp" +#include "binsrv/events/generic_post_header_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { template <> class generic_post_header_impl; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_STOP_POST_HEADER_IMPL_FWD_HPP +#endif // BINSRV_EVENTS_STOP_POST_HEADER_IMPL_FWD_HPP diff --git a/src/binsrv/event/unknown_body.cpp b/src/binsrv/events/unknown_body.cpp similarity index 89% rename from src/binsrv/event/unknown_body.cpp rename to src/binsrv/events/unknown_body.cpp index d16a492..4af4934 100644 --- a/src/binsrv/event/unknown_body.cpp +++ b/src/binsrv/events/unknown_body.cpp @@ -13,14 +13,14 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/unknown_body.hpp" +#include "binsrv/events/unknown_body.hpp" #include -namespace binsrv::event { +namespace binsrv::events { std::ostream &operator<<(std::ostream &output, const unknown_body & /* obj */) { return output; } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/unknown_body.hpp b/src/binsrv/events/unknown_body.hpp similarity index 80% rename from src/binsrv/event/unknown_body.hpp rename to src/binsrv/events/unknown_body.hpp index 53490c7..8926dc6 100644 --- a/src/binsrv/event/unknown_body.hpp +++ b/src/binsrv/events/unknown_body.hpp @@ -13,14 +13,14 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_UNKNOWN_BODY_HPP -#define BINSRV_EVENT_UNKNOWN_BODY_HPP +#ifndef BINSRV_EVENTS_UNKNOWN_BODY_HPP +#define BINSRV_EVENTS_UNKNOWN_BODY_HPP -#include "binsrv/event/unknown_body_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/unknown_body_fwd.hpp" // IWYU pragma: export #include "util/byte_span_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { class [[nodiscard]] unknown_body { public: @@ -30,6 +30,6 @@ class [[nodiscard]] unknown_body { explicit unknown_body(util::const_byte_span /*unused*/) noexcept {} }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_UNKNOWN_BODY_HPP +#endif // BINSRV_EVENTS_UNKNOWN_BODY_HPP diff --git a/src/binsrv/event/unknown_body_fwd.hpp b/src/binsrv/events/unknown_body_fwd.hpp similarity index 81% rename from src/binsrv/event/unknown_body_fwd.hpp rename to src/binsrv/events/unknown_body_fwd.hpp index 76e1c84..e513403 100644 --- a/src/binsrv/event/unknown_body_fwd.hpp +++ b/src/binsrv/events/unknown_body_fwd.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_UNKNOWN_BODY_FWD_HPP -#define BINSRV_EVENT_UNKNOWN_BODY_FWD_HPP +#ifndef BINSRV_EVENTS_UNKNOWN_BODY_FWD_HPP +#define BINSRV_EVENTS_UNKNOWN_BODY_FWD_HPP #include -namespace binsrv::event { +namespace binsrv::events { class unknown_body; std::ostream &operator<<(std::ostream &output, const unknown_body &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_UNKNOWN_BODY_FWD_HPPß +#endif // BINSRV_EVENTS_UNKNOWN_BODY_FWD_HPPß diff --git a/src/binsrv/event/unknown_post_header.cpp b/src/binsrv/events/unknown_post_header.cpp similarity index 89% rename from src/binsrv/event/unknown_post_header.cpp rename to src/binsrv/events/unknown_post_header.cpp index f5ae783..cf46aeb 100644 --- a/src/binsrv/event/unknown_post_header.cpp +++ b/src/binsrv/events/unknown_post_header.cpp @@ -13,15 +13,15 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "binsrv/event/unknown_post_header.hpp" +#include "binsrv/events/unknown_post_header.hpp" #include -namespace binsrv::event { +namespace binsrv::events { std::ostream &operator<<(std::ostream &output, const unknown_post_header & /* obj */) { return output; } -} // namespace binsrv::event +} // namespace binsrv::events diff --git a/src/binsrv/event/unknown_post_header.hpp b/src/binsrv/events/unknown_post_header.hpp similarity index 78% rename from src/binsrv/event/unknown_post_header.hpp rename to src/binsrv/events/unknown_post_header.hpp index 0c3830f..b15f351 100644 --- a/src/binsrv/event/unknown_post_header.hpp +++ b/src/binsrv/events/unknown_post_header.hpp @@ -13,18 +13,18 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_UNKNOWN_POST_HEADER_HPP -#define BINSRV_EVENT_UNKNOWN_POST_HEADER_HPP +#ifndef BINSRV_EVENTS_UNKNOWN_POST_HEADER_HPP +#define BINSRV_EVENTS_UNKNOWN_POST_HEADER_HPP -#include "binsrv/event/unknown_post_header_fwd.hpp" // IWYU pragma: export +#include "binsrv/events/unknown_post_header_fwd.hpp" // IWYU pragma: export #include -#include "binsrv/event/protocol_traits_fwd.hpp" +#include "binsrv/events/protocol_traits_fwd.hpp" #include "util/byte_span_fwd.hpp" -namespace binsrv::event { +namespace binsrv::events { class [[nodiscard]] unknown_post_header { public: @@ -36,6 +36,6 @@ class [[nodiscard]] unknown_post_header { explicit unknown_post_header(util::const_byte_span /*unused*/) noexcept {} }; -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_UNKNOWN_POST_HEADER_HPP +#endif // BINSRV_EVENTS_UNKNOWN_POST_HEADER_HPP diff --git a/src/binsrv/event/unknown_post_header_fwd.hpp b/src/binsrv/events/unknown_post_header_fwd.hpp similarity index 80% rename from src/binsrv/event/unknown_post_header_fwd.hpp rename to src/binsrv/events/unknown_post_header_fwd.hpp index 2487bd3..5770172 100644 --- a/src/binsrv/event/unknown_post_header_fwd.hpp +++ b/src/binsrv/events/unknown_post_header_fwd.hpp @@ -13,16 +13,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#ifndef BINSRV_EVENT_UNKNOWN_POST_HEADER_FWD_HPP -#define BINSRV_EVENT_UNKNOWN_POST_HEADER_FWD_HPP +#ifndef BINSRV_EVENTS_UNKNOWN_POST_HEADER_FWD_HPP +#define BINSRV_EVENTS_UNKNOWN_POST_HEADER_FWD_HPP #include -namespace binsrv::event { +namespace binsrv::events { class unknown_post_header; std::ostream &operator<<(std::ostream &output, const unknown_post_header &obj); -} // namespace binsrv::event +} // namespace binsrv::events -#endif // BINSRV_EVENT_UNKNOWN_POST_HEADER_FWD_HPP +#endif // BINSRV_EVENTS_UNKNOWN_POST_HEADER_FWD_HPP diff --git a/src/binsrv/storage.cpp b/src/binsrv/storage.cpp index 2032821..b285e5c 100644 --- a/src/binsrv/storage.cpp +++ b/src/binsrv/storage.cpp @@ -35,7 +35,7 @@ #include "binsrv/storage_config.hpp" #include "binsrv/storage_metadata.hpp" -#include "binsrv/event/protocol_traits_fwd.hpp" +#include "binsrv/events/protocol_traits_fwd.hpp" #include "binsrv/gtids/gtid.hpp" #include "binsrv/gtids/gtid_set.hpp" @@ -181,7 +181,7 @@ storage::open_binlog(std::string_view binlog_name) { if (!binlog_exists) { // writing the magic binlog footprint only if this is a newly // created file - backend_->write_data_to_stream(event::magic_binlog_payload); + backend_->write_data_to_stream(events::magic_binlog_payload); gtids::optional_gtid_set previous_binlog_gtids{}; gtids::optional_gtid_set added_binlog_gtids{}; @@ -191,7 +191,7 @@ storage::open_binlog(std::string_view binlog_name) { } binlog_records_.emplace_back( - std::string{binlog_name}, event::magic_binlog_offset, + std::string{binlog_name}, events::magic_binlog_offset, std::move(previous_binlog_gtids), std::move(added_binlog_gtids), ctime_timestamp_range{}); save_binlog_metadata(get_current_binlog_record()); @@ -200,14 +200,14 @@ storage::open_binlog(std::string_view binlog_name) { } else { assert(get_current_position() == open_stream_offset); if (open_stream_offset == 0ULL) { - backend_->write_data_to_stream(event::magic_binlog_payload); - get_current_binlog_record().size = event::magic_binlog_offset; + backend_->write_data_to_stream(events::magic_binlog_payload); + get_current_binlog_record().size = events::magic_binlog_offset; result = open_binlog_status::opened_empty; - } else if (open_stream_offset == event::magic_binlog_offset) { + } else if (open_stream_offset == events::magic_binlog_offset) { result = open_binlog_status::opened_at_magic_paylod_offset; } else { // position is beyond magic payload offset - assert(open_stream_offset > event::magic_binlog_offset); + assert(open_stream_offset > events::magic_binlog_offset); result = open_binlog_status::opened_with_data_present; } }