26#ifndef ROUTING_CLASSIC_PROTOCOL_STATE_INCLUDED
27#define ROUTING_CLASSIC_PROTOCOL_STATE_INCLUDED
80 vars_.insert_or_assign(std::move(k), std::move(v));
94 const auto it =
vars_.find(k);
95 if (it ==
vars_.end())
return {std::nullopt};
113 const auto it =
vars_.find(k);
114 if (it ==
vars_.end())
return {std::nullopt};
119 using iterator = std::map<key_type, value_type>::iterator;
138 std::map<key_type, value_type, std::less<>>
vars_;
146 std::optional<classic_protocol::message::server::Greeting>
184 std::optional<classic_protocol::message::client::Greeting> msg) {
194 std::optional<classic_protocol::message::server::Greeting> msg) {
308 std::optional<std::string>
get(
const std::string_view &auth_method)
const {
315 template <
class... Args>
320 void erase(
const std::string &auth_method) {
system-variables as returned by the server.
Definition: classic_protocol_state.h:68
const_iterator begin() const
Definition: classic_protocol_state.h:123
std::map< key_type, value_type >::const_iterator const_iterator
Definition: classic_protocol_state.h:120
std::string_view key_view_type
Definition: classic_protocol_state.h:71
void clear()
clear the system-vars.
Definition: classic_protocol_state.h:135
void set(key_type k, value_type v)
set k to v.
Definition: classic_protocol_state.h:79
std::map< key_type, value_type, std::less<> > vars_
Definition: classic_protocol_state.h:138
std::optional< value_type > find(const key_view_type &k) const
find 'k' in sytem-vars.
Definition: classic_protocol_state.h:93
std::map< key_type, value_type >::iterator iterator
Definition: classic_protocol_state.h:119
iterator end()
Definition: classic_protocol_state.h:124
iterator begin()
Definition: classic_protocol_state.h:122
bool empty() const
check if there is no system-var.
Definition: classic_protocol_state.h:130
std::string key_type
Definition: classic_protocol_state.h:70
const_iterator end() const
Definition: classic_protocol_state.h:125
value_type get(const key_view_type &k) const
get 'k' from system-vars.
Definition: classic_protocol_state.h:112
std::optional< std::string > value_type
Definition: classic_protocol_state.h:72
protocol state of a classic protocol connection.
Definition: classic_protocol_state.h:40
HandshakeState handshake_state_
Definition: classic_protocol_state.h:294
classic_protocol::capabilities::value_type server_caps_
Definition: classic_protocol_state.h:272
uint8_t seq_id() const
Definition: classic_protocol_state.h:199
std::string schema()
Definition: classic_protocol_state.h:240
ClassicProtocolState()=default
void sent_attributes(std::string attrs)
Definition: classic_protocol_state.h:249
void seq_id(uint8_t id)
Definition: classic_protocol_state.h:201
std::string auth_method_name() const
Definition: classic_protocol_state.h:221
const std::optional< FrameInfo > & current_frame() const
Definition: classic_protocol_state.h:211
void handshake_state(HandshakeState state)
Definition: classic_protocol_state.h:255
uint8_t & seq_id()
Definition: classic_protocol_state.h:198
std::optional< classic_protocol::message::server::Greeting > server_greeting() const
Definition: classic_protocol_state.h:188
HandshakeState handshake_state() const
Definition: classic_protocol_state.h:253
void server_capabilities(classic_protocol::capabilities::value_type caps)
Definition: classic_protocol_state.h:158
std::string auth_method_data() const
Definition: classic_protocol_state.h:229
HandshakeState
Definition: classic_protocol_state.h:42
std::string sent_attributes()
Definition: classic_protocol_state.h:248
std::string auth_method_name_
Definition: classic_protocol_state.h:288
void client_greeting(std::optional< classic_protocol::message::client::Greeting > msg)
Definition: classic_protocol_state.h:183
void server_greeting(std::optional< classic_protocol::message::server::Greeting > msg)
Definition: classic_protocol_state.h:193
std::string sent_attributes_
Definition: classic_protocol_state.h:286
std::optional< FrameInfo > & current_frame()
Definition: classic_protocol_state.h:210
std::optional< uint8_t > msg_type_
Definition: classic_protocol_state.h:279
std::optional< uint8_t > & current_msg_type()
Definition: classic_protocol_state.h:215
classic_protocol::capabilities::value_type client_caps_
Definition: classic_protocol_state.h:273
SystemVariables system_variables_
Definition: classic_protocol_state.h:296
uint8_t seq_id_
Definition: classic_protocol_state.h:281
void client_capabilities(classic_protocol::capabilities::value_type caps)
Definition: classic_protocol_state.h:162
uint64_t columns_left
Definition: classic_protocol_state.h:218
void schema(std::string s)
Definition: classic_protocol_state.h:241
std::optional< classic_protocol::message::server::Greeting > server_greeting_
Definition: classic_protocol_state.h:276
std::string username_
Definition: classic_protocol_state.h:283
void auth_method_name(std::string name)
Definition: classic_protocol_state.h:225
void attributes(std::string attrs)
Definition: classic_protocol_state.h:245
std::optional< FrameInfo > current_frame_
Definition: classic_protocol_state.h:278
ClassicProtocolState(classic_protocol::capabilities::value_type server_caps, classic_protocol::capabilities::value_type client_caps, std::optional< classic_protocol::message::server::Greeting > server_greeting, std::string username, std::string schema, std::string attributes)
Definition: classic_protocol_state.h:143
classic_protocol::capabilities::value_type client_capabilities() const
Definition: classic_protocol_state.h:166
uint32_t params_left
Definition: classic_protocol_state.h:219
classic_protocol::status::value_type status_flags_
Definition: classic_protocol_state.h:292
void auth_method_data(std::string data)
Definition: classic_protocol_state.h:233
std::optional< classic_protocol::message::client::Greeting > client_greeting() const
Definition: classic_protocol_state.h:178
std::string auth_method_data_
Definition: classic_protocol_state.h:289
const SystemVariables & system_variables() const
Definition: classic_protocol_state.h:269
const std::optional< uint8_t > & current_msg_type() const
Definition: classic_protocol_state.h:216
std::optional< classic_protocol::message::client::Greeting > client_greeting_
Definition: classic_protocol_state.h:275
std::string recv_attributes_
Definition: classic_protocol_state.h:285
classic_protocol::capabilities::value_type server_capabilities() const
Definition: classic_protocol_state.h:170
void username(std::string user)
Definition: classic_protocol_state.h:238
std::string username()
Definition: classic_protocol_state.h:237
std::string attributes()
Definition: classic_protocol_state.h:244
classic_protocol::capabilities::value_type shared_capabilities() const
Definition: classic_protocol_state.h:174
SystemVariables & system_variables()
Definition: classic_protocol_state.h:267
std::string schema_
Definition: classic_protocol_state.h:284
credentials per authentication method.
Definition: classic_protocol_state.h:306
void clear()
Definition: classic_protocol_state.h:324
bool empty() const
Definition: classic_protocol_state.h:326
std::optional< std::string > get(const std::string_view &auth_method) const
Definition: classic_protocol_state.h:308
void emplace(Args &&...args)
Definition: classic_protocol_state.h:316
std::map< std::string, std::string, std::less<> > credentials_
Definition: classic_protocol_state.h:329
void erase(const std::string &auth_method)
Definition: classic_protocol_state.h:320
Definition: classic_protocol_state.h:299
bool trace_commands() const
trace the events of the commands.
Definition: classic_protocol_state.h:360
void gtid_executed(const std::string >id_execed)
Definition: classic_protocol_state.h:364
classic_protocol::status::value_type status_flags_
Definition: classic_protocol_state.h:391
PreparedStatements prepared_stmts_
Definition: classic_protocol_state.h:393
void wait_for_my_writes(bool v)
Definition: classic_protocol_state.h:369
const PreparedStatements & prepared_statements() const
Definition: classic_protocol_state.h:346
std::optional< AccessMode > access_mode_
Definition: classic_protocol_state.h:403
void access_mode(std::optional< AccessMode > v)
Definition: classic_protocol_state.h:385
std::string gtid_executed() const
Definition: classic_protocol_state.h:367
PreparedStatements & prepared_statements()
Definition: classic_protocol_state.h:349
bool wait_for_my_writes_
Definition: classic_protocol_state.h:400
bool wait_for_my_writes() const
Definition: classic_protocol_state.h:370
std::unordered_map< uint32_t, PreparedStatement > PreparedStatements
Definition: classic_protocol_state.h:344
void trace_commands(bool val)
Definition: classic_protocol_state.h:361
classic_protocol::status::value_type status_flags() const
Definition: classic_protocol_state.h:336
const Credentials & credentials() const
Definition: classic_protocol_state.h:334
Credentials & credentials()
Definition: classic_protocol_state.h:332
std::string gtid_executed_
Definition: classic_protocol_state.h:398
bool trace_commands_
Definition: classic_protocol_state.h:396
AccessMode
Definition: classic_protocol_state.h:379
std::chrono::seconds wait_for_my_writes_timeout_
Definition: classic_protocol_state.h:401
std::chrono::seconds wait_for_my_writes_timeout() const
Definition: classic_protocol_state.h:372
void status_flags(classic_protocol::status::value_type val)
Definition: classic_protocol_state.h:340
std::optional< AccessMode > access_mode() const
Definition: classic_protocol_state.h:384
Credentials credentials_
Definition: classic_protocol_state.h:388
void wait_for_my_writes_timeout(std::chrono::seconds timeout)
Definition: classic_protocol_state.h:375
Definition: classic_protocol_state.h:406
char * user
Definition: mysqladmin.cc:66
std::bitset< 32 > value_type
Definition: classic_protocol_constants.h:73
std::bitset< 16 > value_type
Definition: classic_protocol_constants.h:168
static bool timeout(bool(*wait_condition)())
Timeout function.
Definition: log0meb.cc:498
Definition: gcs_xcom_synode.h:64
case opt name
Definition: sslopt-case.h:29
Definition: classic_protocol_state.h:203
size_t forwarded_frame_size_
size of the whole frame that's already forwarded.
Definition: classic_protocol_state.h:206
size_t frame_size_
size of the whole frame.
Definition: classic_protocol_state.h:205
uint8_t seq_id_
sequence id.
Definition: classic_protocol_state.h:204
double seconds()
Definition: task.cc:310
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510