Kerollmops · GitHub

@Kerollmops

Copy link Copy Markdown

Contributor

This example panic when encounting the scan key results.

Spotting two bugs:

  • the raw::Client::scan does not understand inclusive bounds correctly
  • the raw::Client::delete_range does not delete anything

@ice1000

Copy link Copy Markdown

Please remove the unused import:

  --> examples/raw.rs:18:61
   |
18 | use tikv_client::{raw::Client, Config, Key, KvPair, Result, Value};
   |                                                             ^^^^^

@Kerollmops

sunxiaoguang

Copy link Copy Markdown

Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although they do look verbose. I guess the type annotations were there on purpose to make the example clear, isn't it @Hoverbear ?

@Hoverbear

Copy link Copy Markdown

Contributor

@sunxiaoguang that was the intention. Do you think it's better to remove them?

I don't really want to encourage people to use &'static str in things other than examples and little toy codes. Maybe it's better to use Vec<u8>s?

@sunxiaoguang

Copy link Copy Markdown

Member

@sunxiaoguang that was the intention. Do you think it's better to remove them?

I personally had difficulties when I just started learning Rust and had to turn to IDE to know the real types. So as a vim user, I think type annotation is more friendly for new learners of Rust.

@sunxiaoguang

Copy link Copy Markdown

Member

Maybe two separate examples for Rust new learners and TiKV new users? They probably like different styles.

Signed-off-by: Clément Renault <renault.cle@gmail.com>

@Kerollmops

@Kerollmops

Copy link Copy Markdown

Contributor Author

I rebased on master to retrieve the modifications about the raw get method returning an optional value and modified the example in consequence.

I also kept the type annotations to make it clear for new users, I think it is not necessary to create multiple examples. Advanced Rust users will understand the beginner example.

I added some comments and forced KEY and VALUE to be Key and Value to keep a consistent display when compared to the keys/values retrieved from the server when running the test.

Hoverbear

Hoverbear

@Hoverbear

@Hoverbear

Copy link Copy Markdown

Contributor

@siddontang

Copy link Copy Markdown

Contributor

CI still failed?

@Hoverbear

@Hoverbear

Copy link Copy Markdown

Contributor

@Hoverbear

@Hoverbear

@Hoverbear

brson

Copy link Copy Markdown

Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brson

Copy link Copy Markdown

Contributor

I do notice that this is failing on rustfmt, though there are existing rustfmt failures. Since the CI is reportedly busted, and it's a pre-existing problem, and this has been waiting for too long, I'm going to force merge. Someone else will clean up the testing mess later.

@brson

Read the original on github.com ↗