MySQL 8.3.0
Source Code Documentation
classic_change_user_sender.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2023, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is also distributed with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23*/
24
25#ifndef ROUTING_CLASSIC_CHANGE_USER_SENDER_INCLUDED
26#define ROUTING_CLASSIC_CHANGE_USER_SENDER_INCLUDED
27
29
30/**
31 * sends COM_CHANGE_USER from router to the server.
32 */
34 public:
35 using ForwardingProcessor::ForwardingProcessor;
36
38 MysqlRoutingClassicConnectionBase *conn, bool in_handshake,
39 std::function<void(const classic_protocol::message::server::Error &)>
40 on_error,
41 TraceEvent *parent_event)
42 : ForwardingProcessor(conn),
43 in_handshake_{in_handshake},
44 on_error_(std::move(on_error)),
45 parent_event_(parent_event) {}
46
47 enum class Stage {
48 Command,
51 Ok,
52 Error,
53 Done,
54 };
55
56 static constexpr std::string_view prefix() { return "change_user"; }
57
59
61 [[nodiscard]] Stage stage() const { return stage_; }
62
63 private:
69
71
72 bool in_handshake_{false};
73
74 std::optional<classic_protocol::message::client::ChangeUser> change_user_msg_;
75
76 std::function<void(const classic_protocol::message::server::Error &err)>
78
81};
82
83#endif
sends COM_CHANGE_USER from router to the server.
Definition: classic_change_user_sender.h:33
stdx::expected< Result, std::error_code > initial_response()
Definition: classic_change_user_sender.cc:298
stdx::expected< Result, std::error_code > ok()
Definition: classic_change_user_sender.cc:338
TraceEvent * parent_event_
Definition: classic_change_user_sender.h:79
static constexpr std::string_view prefix()
Definition: classic_change_user_sender.h:56
stdx::expected< Result, std::error_code > error()
Definition: classic_change_user_sender.cc:386
std::function< void(const classic_protocol::message::server::Error &err)> on_error_
Definition: classic_change_user_sender.h:77
void stage(Stage stage)
Definition: classic_change_user_sender.h:60
stdx::expected< Result, std::error_code > process() override
Definition: classic_change_user_sender.cc:50
TraceEvent * trace_event_command_
Definition: classic_change_user_sender.h:80
stdx::expected< Result, std::error_code > command()
Definition: classic_change_user_sender.cc:256
Stage stage() const
Definition: classic_change_user_sender.h:61
Stage stage_
Definition: classic_change_user_sender.h:70
bool in_handshake_
Definition: classic_change_user_sender.h:72
ChangeUserSender(MysqlRoutingClassicConnectionBase *conn, bool in_handshake, std::function< void(const classic_protocol::message::server::Error &)> on_error, TraceEvent *parent_event)
Definition: classic_change_user_sender.h:37
stdx::expected< Result, std::error_code > final_response()
Definition: classic_change_user_sender.cc:306
Stage
Definition: classic_change_user_sender.h:47
std::optional< classic_protocol::message::client::ChangeUser > change_user_msg_
Definition: classic_change_user_sender.h:74
a processor base class with helper functions.
Definition: forwarding_processor.h:36
Definition: classic_connection_base.h:257
Definition: expected.h:943
borrowable::message::server::Error< false > Error
Definition: classic_protocol_message.h:1410
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:926
Definition: varlen_sort.h:174
Definition: trace_span.h:34