26#ifndef ROUTING_CLASSIC_PROTOCOL_STATE_INCLUDED
27#define ROUTING_CLASSIC_PROTOCOL_STATE_INCLUDED
79 vars_.insert_or_assign(std::move(k), std::move(v));
93 const auto it =
vars_.find(k);
94 if (it ==
vars_.end())
return {std::nullopt};
112 const auto it =
vars_.find(k);
113 if (it ==
vars_.end())
return {std::nullopt};
118 using iterator = std::map<key_type, value_type>::iterator;
137 std::map<key_type, value_type, std::less<>>
vars_;
145 std::optional<classic_protocol::message::server::Greeting>
183 std::optional<classic_protocol::message::client::Greeting> msg) {
193 std::optional<classic_protocol::message::server::Greeting> msg) {
system-variables as returned by the server.
Definition: classic_protocol_state.h:67
const_iterator begin() const
Definition: classic_protocol_state.h:122
std::map< key_type, value_type >::const_iterator const_iterator
Definition: classic_protocol_state.h:119
std::string_view key_view_type
Definition: classic_protocol_state.h:70
void clear()
clear the system-vars.
Definition: classic_protocol_state.h:134
void set(key_type k, value_type v)
set k to v.
Definition: classic_protocol_state.h:78
std::map< key_type, value_type, std::less<> > vars_
Definition: classic_protocol_state.h:137
std::optional< value_type > find(const key_view_type &k) const
find 'k' in sytem-vars.
Definition: classic_protocol_state.h:92
std::map< key_type, value_type >::iterator iterator
Definition: classic_protocol_state.h:118
iterator end()
Definition: classic_protocol_state.h:123
iterator begin()
Definition: classic_protocol_state.h:121
bool empty() const
check if there is no system-var.
Definition: classic_protocol_state.h:129
std::string key_type
Definition: classic_protocol_state.h:69
const_iterator end() const
Definition: classic_protocol_state.h:124
value_type get(const key_view_type &k) const
get 'k' from system-vars.
Definition: classic_protocol_state.h:111
std::optional< std::string > value_type
Definition: classic_protocol_state.h:71
protocol state of a classic protocol connection.
Definition: classic_protocol_state.h:39
HandshakeState handshake_state_
Definition: classic_protocol_state.h:293
classic_protocol::capabilities::value_type server_caps_
Definition: classic_protocol_state.h:271
uint8_t seq_id() const
Definition: classic_protocol_state.h:198
std::string schema()
Definition: classic_protocol_state.h:239
ClassicProtocolState()=default
void sent_attributes(std::string attrs)
Definition: classic_protocol_state.h:248
void seq_id(uint8_t id)
Definition: classic_protocol_state.h:200
std::string auth_method_name() const
Definition: classic_protocol_state.h:220
const std::optional< FrameInfo > & current_frame() const
Definition: classic_protocol_state.h:210
void handshake_state(HandshakeState state)
Definition: classic_protocol_state.h:254
uint8_t & seq_id()
Definition: classic_protocol_state.h:197
std::optional< classic_protocol::message::server::Greeting > server_greeting() const
Definition: classic_protocol_state.h:187
HandshakeState handshake_state() const
Definition: classic_protocol_state.h:252
void server_capabilities(classic_protocol::capabilities::value_type caps)
Definition: classic_protocol_state.h:157
std::string auth_method_data() const
Definition: classic_protocol_state.h:228
HandshakeState
Definition: classic_protocol_state.h:41
std::string sent_attributes()
Definition: classic_protocol_state.h:247
std::string auth_method_name_
Definition: classic_protocol_state.h:287
void client_greeting(std::optional< classic_protocol::message::client::Greeting > msg)
Definition: classic_protocol_state.h:182
void server_greeting(std::optional< classic_protocol::message::server::Greeting > msg)
Definition: classic_protocol_state.h:192
std::string sent_attributes_
Definition: classic_protocol_state.h:285
std::optional< FrameInfo > & current_frame()
Definition: classic_protocol_state.h:209
std::optional< uint8_t > msg_type_
Definition: classic_protocol_state.h:278
std::optional< uint8_t > & current_msg_type()
Definition: classic_protocol_state.h:214
classic_protocol::capabilities::value_type client_caps_
Definition: classic_protocol_state.h:272
SystemVariables system_variables_
Definition: classic_protocol_state.h:295
uint8_t seq_id_
Definition: classic_protocol_state.h:280
void client_capabilities(classic_protocol::capabilities::value_type caps)
Definition: classic_protocol_state.h:161
uint64_t columns_left
Definition: classic_protocol_state.h:217
void schema(std::string s)
Definition: classic_protocol_state.h:240
std::optional< classic_protocol::message::server::Greeting > server_greeting_
Definition: classic_protocol_state.h:275
std::string username_
Definition: classic_protocol_state.h:282
void auth_method_name(std::string name)
Definition: classic_protocol_state.h:224
void attributes(std::string attrs)
Definition: classic_protocol_state.h:244
std::optional< FrameInfo > current_frame_
Definition: classic_protocol_state.h:277
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:142
classic_protocol::capabilities::value_type client_capabilities() const
Definition: classic_protocol_state.h:165
uint32_t params_left
Definition: classic_protocol_state.h:218
classic_protocol::status::value_type status_flags_
Definition: classic_protocol_state.h:291
void auth_method_data(std::string data)
Definition: classic_protocol_state.h:232
std::optional< classic_protocol::message::client::Greeting > client_greeting() const
Definition: classic_protocol_state.h:177
std::string auth_method_data_
Definition: classic_protocol_state.h:288
const SystemVariables & system_variables() const
Definition: classic_protocol_state.h:268
const std::optional< uint8_t > & current_msg_type() const
Definition: classic_protocol_state.h:215
std::optional< classic_protocol::message::client::Greeting > client_greeting_
Definition: classic_protocol_state.h:274
std::string recv_attributes_
Definition: classic_protocol_state.h:284
classic_protocol::capabilities::value_type server_capabilities() const
Definition: classic_protocol_state.h:169
void username(std::string user)
Definition: classic_protocol_state.h:237
std::string username()
Definition: classic_protocol_state.h:236
std::string attributes()
Definition: classic_protocol_state.h:243
classic_protocol::capabilities::value_type shared_capabilities() const
Definition: classic_protocol_state.h:173
SystemVariables & system_variables()
Definition: classic_protocol_state.h:266
std::string schema_
Definition: classic_protocol_state.h:283
Definition: classic_protocol_state.h:298
bool trace_commands() const
trace the events of the commands.
Definition: classic_protocol_state.h:329
void gtid_executed(const std::string >id_execed)
Definition: classic_protocol_state.h:333
classic_protocol::status::value_type status_flags_
Definition: classic_protocol_state.h:360
PreparedStatements prepared_stmts_
Definition: classic_protocol_state.h:362
void wait_for_my_writes(bool v)
Definition: classic_protocol_state.h:338
const PreparedStatements & prepared_statements() const
Definition: classic_protocol_state.h:315
std::optional< AccessMode > access_mode_
Definition: classic_protocol_state.h:372
void access_mode(std::optional< AccessMode > v)
Definition: classic_protocol_state.h:354
std::string gtid_executed() const
Definition: classic_protocol_state.h:336
PreparedStatements & prepared_statements()
Definition: classic_protocol_state.h:318
bool wait_for_my_writes_
Definition: classic_protocol_state.h:369
bool wait_for_my_writes() const
Definition: classic_protocol_state.h:339
std::unordered_map< uint32_t, PreparedStatement > PreparedStatements
Definition: classic_protocol_state.h:313
void password(std::optional< std::string > pw)
Definition: classic_protocol_state.h:302
std::optional< std::string > password_
Definition: classic_protocol_state.h:357
void trace_commands(bool val)
Definition: classic_protocol_state.h:330
classic_protocol::status::value_type status_flags() const
Definition: classic_protocol_state.h:305
std::string gtid_executed_
Definition: classic_protocol_state.h:367
bool trace_commands_
Definition: classic_protocol_state.h:365
AccessMode
Definition: classic_protocol_state.h:348
std::chrono::seconds wait_for_my_writes_timeout_
Definition: classic_protocol_state.h:370
std::chrono::seconds wait_for_my_writes_timeout() const
Definition: classic_protocol_state.h:341
void status_flags(classic_protocol::status::value_type val)
Definition: classic_protocol_state.h:309
const std::optional< std::string > & password() const
Definition: classic_protocol_state.h:303
std::optional< AccessMode > access_mode() const
Definition: classic_protocol_state.h:353
void wait_for_my_writes_timeout(std::chrono::seconds timeout)
Definition: classic_protocol_state.h:344
Definition: classic_protocol_state.h:375
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:202
size_t forwarded_frame_size_
size of the whole frame that's already forwarded.
Definition: classic_protocol_state.h:205
size_t frame_size_
size of the whole frame.
Definition: classic_protocol_state.h:204
uint8_t seq_id_
sequence id.
Definition: classic_protocol_state.h:203
double seconds()
Definition: task.cc:310
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510