remove compact code

Signed-off-by: longfangsong <longfangsong@icloud.com>
This commit is contained in:
longfangsong 2020-06-04 13:14:45 +08:00
parent fe765f1911
commit f02bdf0820
4 changed files with 8 additions and 15 deletions

View File

@ -20,9 +20,9 @@ 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.1", features = ["async-await", "thread-pool"] }
grpcio = { git = "https://github.com/tikv/grpc-rs.git", features = [ "secure", "prost-codec" ], default-features = false }
kvproto = { git = "https://github.com/longfangsong/kvproto.git", features = [ "prost-codec" ], default-features = false }
lazy_static = "1"
log = "0.4"
rand = "0.7"
@ -48,3 +48,4 @@ fail = { version = "0.3", features = [ "failpoints" ] }
[patch.crates-io]
raft-proto = { git = "https://github.com/tikv/raft-rs", rev = "e624c1d48460940a40d8aa69b5329460d9af87dd" }
grpcio-compiler = { git = "https://github.com/tikv/grpc-rs.git", version = "0.5.0", default-features = false }

View File

@ -14,7 +14,6 @@ use crate::{
};
use derive_new::new;
use futures::compat::Compat01As03;
use futures::future::BoxFuture;
use futures::prelude::*;
use grpcio::CallOption;
@ -83,11 +82,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),
};

View File

@ -16,7 +16,6 @@ use crate::{
transaction::Timestamp,
Error, Result,
};
use futures::compat::Compat01As03;
use futures::prelude::*;
use grpcio::{CallOption, Environment};
use kvproto::{metapb, pdpb};
@ -56,7 +55,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| {
@ -87,7 +85,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| {
@ -116,7 +113,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| {
@ -141,7 +137,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| {
@ -280,7 +275,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))

View File

@ -15,7 +15,6 @@ use crate::{transaction::Timestamp, Error, Result};
use futures::{
channel::{mpsc, oneshot},
compat::*,
executor::block_on,
join, pin_mut,
prelude::*,
@ -54,8 +53,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,
))
});