Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor mysql server for runtime #274

Merged
merged 29 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b8f6451
feat(docs): add version v0.2.0 docs
xuanyuan300 Aug 2, 2022
624d93c
feat(pisa-proxy, runtime): refactor mysql handle_command
xuanyuan300 Aug 23, 2022
8dacc23
Merge branch 'master' of github.com:xuanyuan300/pisanix
xuanyuan300 Aug 24, 2022
8397eb8
feat(pisa-proxy, runtime): add handshake
xuanyuan300 Aug 24, 2022
df7e731
fix(pisa-proxy, protocol): fix ServerHandshakeCodec args
xuanyuan300 Aug 24, 2022
3a261b0
fix(pisa-proxy, protocol): fix encode, auth error
xuanyuan300 Aug 24, 2022
67faceb
feat(pisa-proxy, protocol): add session trait
xuanyuan300 Aug 24, 2022
eafaaec
fix(pisa-proxy, protocol): fix com_execute, remove println
xuanyuan300 Aug 25, 2022
4d7b89a
feat(pisa-proxy, protocol): add autocommit to session
xuanyuan300 Aug 25, 2022
3b527d8
fix(pisa-proxy, protocol): add session set_db in handle int db
xuanyuan300 Aug 25, 2022
b772d37
fix(pisa-proxy, runtime): reafctor server complete
xuanyuan300 Aug 25, 2022
731a11e
Merge branch 'refactor-mysqlserver-codec6' of https://github.com/xuan…
xuanyuan300 Aug 25, 2022
f8587a2
chore(pisa-proxy, runtime): add comments, remove unused code
xuanyuan300 Aug 25, 2022
d13744a
chore(pisa-proxy, protocol): add comments
xuanyuan300 Aug 25, 2022
be26e8e
feat(pisa-proxy, runtime): refactor mysql handle_command
xuanyuan300 Aug 23, 2022
c48f138
feat(pisa-proxy, runtime): add handshake
xuanyuan300 Aug 24, 2022
76fe925
fix(pisa-proxy, protocol): fix ServerHandshakeCodec args
xuanyuan300 Aug 24, 2022
c62cbfe
fix(pisa-proxy, protocol): fix encode, auth error
xuanyuan300 Aug 24, 2022
0018599
feat(pisa-proxy, protocol): add session trait
xuanyuan300 Aug 24, 2022
6d841ec
fix(pisa-proxy, protocol): fix com_execute, remove println
xuanyuan300 Aug 25, 2022
d66e667
feat(pisa-proxy, protocol): add autocommit to session
xuanyuan300 Aug 25, 2022
c06348c
fix(pisa-proxy, runtime): reafctor server complete
xuanyuan300 Aug 25, 2022
4b2aa20
fix(pisa-proxy, protocol): add session set_db in handle int db
xuanyuan300 Aug 25, 2022
5999d71
chore(pisa-proxy, runtime): add comments, remove unused code
xuanyuan300 Aug 25, 2022
dec2d15
fix(pisa-proxy, chore): fix conflicts for rebase
xuanyuan300 Aug 25, 2022
f7556cc
Merge branch 'refactor-mysqlserver-codec6' of github.com:xuanyuan300/…
xuanyuan300 Aug 25, 2022
1036083
chore(pisa-proxy, protocol): remove unused enum
xuanyuan300 Aug 25, 2022
ebefc23
chore(docs): reset doc
xuanyuan300 Aug 25, 2022
b80b706
chore(docs): fix space
xuanyuan300 Aug 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,4 @@ spec:
- ^select
target: read
type: regex
```
```
2 changes: 1 addition & 1 deletion pisa-proxy/protocol/mysql/src/client/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ mod test {
use super::{handshake, ClientAuth};
use crate::client::{
codec::ClientCodec,
stream::{LocalStream, StreamWrapper},
stream::LocalStream,
};

#[test]
Expand Down
1 change: 1 addition & 0 deletions pisa-proxy/protocol/mysql/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub mod row;
pub mod server;
pub mod util;
mod value;
pub mod session;

#[macro_use]
extern crate lazy_static;
87 changes: 86 additions & 1 deletion pisa-proxy/protocol/mysql/src/mysql_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,91 @@ iota! {
,COM_RESET_CONNECTION
}

#[allow(non_camel_case_types)]
#[derive(Debug)]
#[repr(u8)]
pub enum ComType {
SLEEP,
QUIT,
INIT_DB,
QUERY,
FIELD_LIST,
CREATE_DB,
DROP_DB,
REFRESH,
SHUTDOWN,
STATISTICS,
PROCESS_INFO,
CONNECT,
PROCESS_KILL,
DEBUG,
PING,
TIME,
DELAYED_INSERT,
CHANGE_USER,
BINLOG_DUMP,
TABLE_DUMP,
CONNECT_OUT,
REGISTER_SLAVE,
STMT_PREPARE,
STMT_EXECUTE,
STMT_SEND_LONG_DATA,
STMT_CLOSE,
STMT_RESET,
SET_OPTION,
STMT_FETCH,
DAEMON,
BINLOG_DUMP_GTID,
RESET_CONNECTION,
}

impl From<u8> for ComType {
#[inline]
fn from(t: u8) -> ComType {
unsafe { std::mem::transmute::<u8, ComType>(t) }
}
}

impl AsRef<str> for ComType {
#[inline]
fn as_ref(&self) -> &str {
match self {
Self::SLEEP => "sleep",
Self::QUIT => "quit",
Self::INIT_DB => "init_db",
Self::QUERY => "query",
Self::FIELD_LIST => "field_list",
Self::CREATE_DB => "create_db",
Self::DROP_DB => "drop_db",
Self::REFRESH => "refresh",
Self::SHUTDOWN => "shutdown",
Self::STATISTICS => "statistics",
Self::PROCESS_INFO => "process_info",
Self::CONNECT => "connect",
Self::PROCESS_KILL => "process_kill",
Self::DEBUG => "debug",
Self::PING => "ping",
Self::TIME => "time",
Self::DELAYED_INSERT => "delayed_insert",
Self::CHANGE_USER => "change_user",
Self::BINLOG_DUMP => "binlog_dump",
Self::TABLE_DUMP => "table_dump",
Self::CONNECT_OUT => "connect_out",
Self::REGISTER_SLAVE => "register_slave",
Self::STMT_PREPARE => "stmt_prepare",
Self::STMT_EXECUTE => "stmt_execute",
Self::STMT_SEND_LONG_DATA => "stmt_send_long_data",
Self::STMT_CLOSE => "stmt_close",
Self::STMT_RESET => "stmt_reset",
Self::SET_OPTION => "set_option",
Self::STMT_FETCH => "stmt_fetch",
Self::DAEMON => "daemon",
Self::BINLOG_DUMP_GTID => "binlog_dump_gtid",
Self::RESET_CONNECTION => "reset_connection",
}
}
}

iota! {
pub const CLIENT_LONG_PASSWORD: u32 = 1 << iota;
,CLIENT_FOUND_ROWS
Expand Down Expand Up @@ -308,4 +393,4 @@ mod test {

assert_eq!(column_flag.as_ref(), "enum");
}
}
}
Loading