From 0ba6f9ff35e008119d76b176a45d6f3d26e71171 Mon Sep 17 00:00:00 2001 From: Aida Getoeva Date: Mon, 28 Sep 2020 08:11:52 -0700 Subject: [PATCH] mononoke/sql_ext: add mysql connections Summary: The diff adds API to create a set of connections: read, read master and write. Reviewed By: ahornby Differential Revision: D23568561 fbshipit-source-id: b3ee954604557497ed56c6b369256b6f76a1e042 --- eden/mononoke/common/rust/sql_ext/Cargo.toml | 1 + eden/mononoke/common/rust/sql_ext/src/lib.rs | 6 +++--- eden/mononoke/common/rust/sql_ext/src/oss.rs | 11 +++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/eden/mononoke/common/rust/sql_ext/Cargo.toml b/eden/mononoke/common/rust/sql_ext/Cargo.toml index 0c30390f8c..42534bd33d 100644 --- a/eden/mononoke/common/rust/sql_ext/Cargo.toml +++ b/eden/mononoke/common/rust/sql_ext/Cargo.toml @@ -10,6 +10,7 @@ include = ["src/**/*.rs"] fbinit = { git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" } futures_ext = { git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" } sql = { git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" } +sql_common = { git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" } anyhow = "1.0" async-trait = "0.1.29" futures-old = { package = "futures", version = "0.1" } diff --git a/eden/mononoke/common/rust/sql_ext/src/lib.rs b/eden/mononoke/common/rust/sql_ext/src/lib.rs index ab658ef2b9..0e3b55ed4e 100644 --- a/eden/mononoke/common/rust/sql_ext/src/lib.rs +++ b/eden/mononoke/common/rust/sql_ext/src/lib.rs @@ -44,15 +44,15 @@ pub mod facebook { #[cfg(fbcode_build)] pub use r#impl::{ - create_myrouter_connections, create_raw_xdb_connections, + create_myrouter_connections, create_mysql_connections, create_raw_xdb_connections, myadmin::{MyAdmin, MyAdminLagMonitor}, myrouter_ready, }; #[cfg(not(fbcode_build))] pub use crate::oss::{ - create_myrouter_connections, create_raw_xdb_connections, myrouter_ready, MyAdmin, - MyAdminLagMonitor, + create_myrouter_connections, create_mysql_connections, create_raw_xdb_connections, + myrouter_ready, MyAdmin, MyAdminLagMonitor, }; #[derive(Copy, Clone, Debug)] diff --git a/eden/mononoke/common/rust/sql_ext/src/oss.rs b/eden/mononoke/common/rust/sql_ext/src/oss.rs index 90c5434e6d..82f4e6c009 100644 --- a/eden/mononoke/common/rust/sql_ext/src/oss.rs +++ b/eden/mononoke/common/rust/sql_ext/src/oss.rs @@ -43,6 +43,17 @@ pub fn create_myrouter_connections( fb_unimplemented!() } +pub fn create_mysql_connections( + _fb: FacebookInit, + _tier: String, + _shard_id: Option, + _read_con_type: ReadConnectionType, + _pool_size_config: PoolSizeConfig, + _readonly: bool, +) -> Result { + fb_unimplemented!() +} + pub fn myrouter_ready( db_addr_opt: Option, mysql_options: MysqlOptions,