Skip to content

Remove compat #149

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

Merged
merged 11 commits into from
Jul 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
319 changes: 172 additions & 147 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ name = "tikv_client"
[dependencies]
derive-new = "0.5"
failure = "0.1"
futures = { version = "0.3.1", features = ["compat", "async-await", "thread-pool"] }
grpcio = { version = "0.5.0", features = [ "secure", "prost-codec" ], default-features = false }
kvproto = { git = "https://github.com/pingcap/kvproto.git", features = [ "prost-codec" ], default-features = false }
futures = { version = "0.3.5", features = ["async-await", "thread-pool"] }
grpcio = { version = "0.6", features = [ "secure", "prost-codec" ], default-features = false }
kvproto = { git = "https://github.com/pingcap/kvproto.git", rev = "1e28226154c374788f38d3a542fc505cd74720f3", features = [ "prost-codec" ], default-features = false }
lazy_static = "1"
log = "0.4"
log = "0.4"
rand = "0.7"
regex = "1"
serde = "1.0"
Expand Down
7 changes: 2 additions & 5 deletions src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ use crate::{
Config, Error, Key, Result, Timestamp,
};
use fail::fail_point;
use futures::{
compat::Compat01As03,
future::{ready, BoxFuture, FutureExt},
};
use futures::future::{ready, BoxFuture, FutureExt};
use grpcio::CallOption;
use kvproto::{errorpb, kvrpcpb, metapb, tikvpb::TikvClient};
use std::{future::Future, sync::Arc, time::Duration};
Expand Down Expand Up @@ -59,7 +56,7 @@ impl KvClient for MockKvClient {
_fut: grpcio::Result<RpcFuture>,
) -> BoxFuture<'static, Result<Resp>>
where
Compat01As03<RpcFuture>: Future<Output = std::result::Result<Resp, ::grpcio::Error>>,
RpcFuture: Future<Output = std::result::Result<Resp, ::grpcio::Error>>,
Resp: HasError + Sized + Clone + Send + 'static,
RpcFuture: Send + 'static,
{
Expand Down
6 changes: 3 additions & 3 deletions tikv-client-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ edition = "2018"

[dependencies]
failure = "0.1"
grpcio = { version = "0.5.0", features = [ "secure", "prost-codec" ], default-features = false }
futures = { version = "0.3.1", features = ["compat", "async-await", "thread-pool"] }
grpcio = { version = "0.6", features = [ "secure", "prost-codec" ], default-features = false }
futures = { version = "0.3.5", features = ["compat", "async-await", "thread-pool"] }
lazy_static = "1"
regex = "1"
serde = "1.0"
Expand All @@ -16,7 +16,7 @@ log = "0.4"
proptest = "0.9"
proptest-derive = "0.1.0"
derive-new = "0.5"
kvproto = { git = "https://github.com/pingcap/kvproto.git", features = [ "prost-codec" ], default-features = false }
kvproto = { git = "https://github.com/pingcap/kvproto.git", rev = "1e28226154c374788f38d3a542fc505cd74720f3", features = [ "prost-codec" ], default-features = false }

[dependencies.prometheus]
version = "0.8"
Expand Down
6 changes: 3 additions & 3 deletions tikv-client-pd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ edition = "2018"

[dependencies]
derive-new = "0.5"
kvproto = { git = "https://github.com/pingcap/kvproto.git", features = [ "prost-codec" ], default-features = false }
futures = { version = "0.3.1", features = ["compat", "async-await", "thread-pool"] }
kvproto = { git = "https://github.com/pingcap/kvproto.git", rev = "1e28226154c374788f38d3a542fc505cd74720f3", features = [ "prost-codec" ], default-features = false }
futures = { version = "0.3.5", features = ["compat", "async-await", "thread-pool"] }
tokio = { version = "0.2", features = ["sync"] }
grpcio = { version = "0.5.0", features = [ "secure", "prost-codec" ], default-features = false }
grpcio = { version = "0.6", features = [ "secure", "prost-codec" ], default-features = false }
log = "0.4"

tikv-client-common = { path = "../tikv-client-common" }
Expand Down
7 changes: 1 addition & 6 deletions tikv-client-pd/src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![allow(dead_code)]

use crate::timestamp::TimestampOracle;
use futures::{compat::Compat01As03, prelude::*};
use futures::prelude::*;
use grpcio::{CallOption, Environment};
use kvproto::{metapb, pdpb};
use std::{
Expand Down Expand Up @@ -51,7 +51,6 @@ impl Cluster {

self.client
.get_region_async_opt(&req, option)
.map(Compat01As03::new)
.unwrap()
.map(move |r| context.done(r.map_err(|e| e.into())))
.and_then(move |resp| {
Expand Down Expand Up @@ -82,7 +81,6 @@ impl Cluster {

self.client
.get_region_by_id_async_opt(&req, option)
.map(Compat01As03::new)
.unwrap()
.map(move |r| context.done(r.map_err(|e| e.into())))
.and_then(move |resp| {
Expand Down Expand Up @@ -111,7 +109,6 @@ impl Cluster {

self.client
.get_store_async_opt(&req, option)
.map(Compat01As03::new)
.unwrap()
.map(move |r| context.done(r.map_err(|e| e.into())))
.and_then(|mut resp| {
Expand All @@ -136,7 +133,6 @@ impl Cluster {

self.client
.get_all_stores_async_opt(&req, option)
.map(Compat01As03::new)
.unwrap()
.map(move |r| context.done(r.map_err(|e| e.into())))
.and_then(|mut resp| {
Expand Down Expand Up @@ -275,7 +271,6 @@ impl Connection {
let option = CallOption::default().timeout(timeout);
let resp = client
.get_members_async_opt(&pdpb::GetMembersRequest::default(), option)
.map(Compat01As03::new)
.map_err(Error::from)?
.await?;
Ok((client, resp))
Expand Down
5 changes: 2 additions & 3 deletions tikv-client-pd/src/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use futures::{
channel::{mpsc, oneshot},
compat::*,
executor::block_on,
join, pin_mut,
prelude::*,
Expand Down Expand Up @@ -53,8 +52,8 @@ impl TimestampOracle {
thread::spawn(move || {
block_on(run_tso(
cluster_id,
rpc_sender.sink_compat().sink_err_into(),
rpc_receiver.compat().err_into(),
rpc_sender.sink_err_into(),
rpc_receiver.err_into(),
request_rx,
))
});
Expand Down
6 changes: 3 additions & 3 deletions tikv-client-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ edition = "2018"


[dependencies]
futures = { version = "0.3.1", features = ["compat", "async-await", "thread-pool"] }
kvproto = { git = "https://github.com/pingcap/kvproto.git", features = [ "prost-codec" ], default-features = false }
futures = { version = "0.3.5", features = ["compat", "async-await", "thread-pool"] }
kvproto = { git = "https://github.com/pingcap/kvproto.git", rev = "1e28226154c374788f38d3a542fc505cd74720f3", features = [ "prost-codec" ], default-features = false }
derive-new = "0.5"
grpcio = { version = "0.5.0", features = [ "secure", "prost-codec" ], default-features = false }
grpcio = { version = "0.6", features = [ "secure", "prost-codec" ], default-features = false }
log = "0.4"

tikv-client-common = { path = "../tikv-client-common" }
12 changes: 6 additions & 6 deletions tikv-client-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod errors;

pub use self::errors::{HasError, HasRegionError};
use derive_new::new;
use futures::{compat::Compat01As03, future::BoxFuture, prelude::*};
use futures::{future::BoxFuture, prelude::*};
use grpcio::{CallOption, Environment};
pub use kvproto::tikvpb::TikvClient;
use std::{sync::Arc, time::Duration};
Expand Down Expand Up @@ -53,7 +53,7 @@ pub trait KvClient {
fut: ::grpcio::Result<RpcFuture>,
) -> BoxFuture<'static, Result<Resp>>
where
Compat01As03<RpcFuture>: Future<Output = std::result::Result<Resp, ::grpcio::Error>>,
RpcFuture: Future<Output = std::result::Result<Resp, ::grpcio::Error>>,
Resp: HasError + Sized + Clone + Send + 'static,
RpcFuture: Send + 'static;

Expand All @@ -74,7 +74,7 @@ impl KvClient for KvRpcClient {
fut: ::grpcio::Result<RpcFuture>,
) -> BoxFuture<'static, Result<Resp>>
where
Compat01As03<RpcFuture>: Future<Output = std::result::Result<Resp, ::grpcio::Error>>,
RpcFuture: Future<Output = std::result::Result<Resp, ::grpcio::Error>>,
Resp: HasError + Sized + Clone + Send + 'static,
RpcFuture: Send + 'static,
{
Expand Down Expand Up @@ -114,7 +114,7 @@ impl<Client: KvClient> Store<Client> {
fut: ::grpcio::Result<RpcFuture>,
) -> BoxFuture<'static, Result<Resp>>
where
Compat01As03<RpcFuture>: Future<Output = std::result::Result<Resp, ::grpcio::Error>>,
RpcFuture: Future<Output = std::result::Result<Resp, ::grpcio::Error>>,
Resp: HasError + Sized + Clone + Send + 'static,
RpcFuture: Send + 'static,
{
Expand All @@ -127,11 +127,11 @@ async fn map_errors_and_trace<Resp, RpcFuture>(
fut: ::grpcio::Result<RpcFuture>,
) -> Result<Resp>
where
Compat01As03<RpcFuture>: Future<Output = std::result::Result<Resp, ::grpcio::Error>>,
RpcFuture: Future<Output = std::result::Result<Resp, ::grpcio::Error>>,
Resp: HasError + Sized + Clone + Send + 'static,
{
let res = match fut {
Ok(f) => Compat01As03::new(f).await,
Ok(f) => f.await,
Err(e) => Err(e),
};

Expand Down