mirror of https://github.com/tikv/client-rust.git
fix compile error
Signed-off-by: Renkai <gaelookair@gmail.com>
This commit is contained in:
parent
4a859b8f6e
commit
25007df435
|
|
@ -26,7 +26,7 @@ async fn main() -> Result<()> {
|
||||||
|
|
||||||
// When we first create a client we receive a `Connect` structure which must be resolved before
|
// When we first create a client we receive a `Connect` structure which must be resolved before
|
||||||
// the client is actually connected and usable.
|
// the client is actually connected and usable.
|
||||||
let client = Client::new(config)?;
|
let client = Client::new(config).await?;
|
||||||
|
|
||||||
// Requests are created from the connected client. These calls return structures which
|
// Requests are created from the connected client. These calls return structures which
|
||||||
// implement `Future`. This means the `Future` must be resolved before the action ever takes
|
// implement `Future`. This means the `Future` must be resolved before the action ever takes
|
||||||
|
|
@ -87,7 +87,7 @@ async fn main() -> Result<()> {
|
||||||
let end = "k2";
|
let end = "k2";
|
||||||
let pairs = client
|
let pairs = client
|
||||||
.with_key_only(true)
|
.with_key_only(true)
|
||||||
.scan((start..=end).to_owned(), 10)
|
.scan((start..=end).to_owned(), 10 as u32)
|
||||||
.await
|
.await
|
||||||
.expect("Could not scan");
|
.expect("Could not scan");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,10 +185,11 @@ mod test {
|
||||||
reconnect_count: Mutex<usize>,
|
reconnect_count: Mutex<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl Reconnect for MockClient {
|
impl Reconnect for MockClient {
|
||||||
type Cl = ();
|
type Cl = ();
|
||||||
|
|
||||||
fn reconnect(&self, _: u64) -> Result<()> {
|
async fn reconnect(&self, _: u64) -> Result<()> {
|
||||||
*self.reconnect_count.lock().unwrap() += 1;
|
*self.reconnect_count.lock().unwrap() += 1;
|
||||||
// Not actually unimplemented, we just don't care about the error.
|
// Not actually unimplemented, we just don't care about the error.
|
||||||
Err(Error::unimplemented())
|
Err(Error::unimplemented())
|
||||||
|
|
@ -223,10 +224,11 @@ mod test {
|
||||||
retry_count: Mutex<usize>,
|
retry_count: Mutex<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl Reconnect for MockClient {
|
impl Reconnect for MockClient {
|
||||||
type Cl = ();
|
type Cl = ();
|
||||||
|
|
||||||
fn reconnect(&self, _: u64) -> Result<()> {
|
async fn reconnect(&self, _: u64) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ proptest! {
|
||||||
fn point(
|
fn point(
|
||||||
pair in any::<KvPair>(),
|
pair in any::<KvPair>(),
|
||||||
) {
|
) {
|
||||||
let client = Client::new(Config::new(pd_addrs())).unwrap();
|
let client = block_on(Client::new(Config::new(pd_addrs()))).unwrap();
|
||||||
|
|
||||||
block_on(
|
block_on(
|
||||||
client.put(pair.key().clone(), pair.value().clone())
|
client.put(pair.key().clone(), pair.value().clone())
|
||||||
|
|
@ -36,7 +36,7 @@ proptest! {
|
||||||
fn batch(
|
fn batch(
|
||||||
kvs in arb_batch(any::<KvPair>(), None),
|
kvs in arb_batch(any::<KvPair>(), None),
|
||||||
) {
|
) {
|
||||||
let client = Client::new(Config::new(pd_addrs())).unwrap();
|
let client = block_on(Client::new(Config::new(pd_addrs()))).unwrap();
|
||||||
let keys = kvs.iter().map(|kv| kv.key()).cloned().collect::<Vec<_>>();
|
let keys = kvs.iter().map(|kv| kv.key()).cloned().collect::<Vec<_>>();
|
||||||
|
|
||||||
block_on(
|
block_on(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue