@@ -19,7 +19,8 @@ const MAX_RAW_KV_SCAN_LIMIT: u32 = 10240;
1919/// Raw requests don't need a wrapping transaction.
2020/// Each request is immediately processed once executed.
2121///
22- /// The returned results of raw requests are [`Future`](std::future::Future)s that must be awaited to execute.
22+ /// The returned results of raw request methods are [`Future`](std::future::Future)s that must be
23+ /// awaited to execute.
2324#[ derive( Clone ) ]
2425pub struct Client {
2526 rpc : Arc < PdRpcClient > ,
@@ -29,14 +30,16 @@ pub struct Client {
2930}
3031
3132impl Client {
32- /// Create a raw [`Client`](Client) .
33+ /// Create a raw [`Client`] and connect to the TiKV cluster .
3334 ///
34- /// It's important to **include more than one PD endpoint** (include all, if possible!)
35- /// This helps avoid having a *single point of failure*.
35+ /// Because TiKV is managed by a [PD](https://github.com/pingcap/pd/) cluster, the endpoints for
36+ /// PD must be provided, not the TiKV nodes. It's important to include more than one PD endpoint
37+ /// (include all endpoints, if possible), this helps avoid having a single point of failure.
3638 ///
3739 /// # Examples
40+ ///
3841 /// ```rust,no_run
39- /// # use tikv_client::{Config, RawClient} ;
42+ /// # use tikv_client::RawClient;
4043 /// # use futures::prelude::*;
4144 /// # futures::executor::block_on(async {
4245 /// let client = RawClient::new(vec!["192.168.0.100"]).await.unwrap();
@@ -46,17 +49,23 @@ impl Client {
4649 Self :: new_with_config ( pd_endpoints, Config :: default ( ) ) . await
4750 }
4851
49- /// Create a raw [`Client`](Client) .
52+ /// Create a raw [`Client`] with a custom configuration, and connect to the TiKV cluster .
5053 ///
51- /// It's important to **include more than one PD endpoint** (include all, if possible!)
52- /// This helps avoid having a *single point of failure*.
54+ /// Because TiKV is managed by a [PD](https://github.com/pingcap/pd/) cluster, the endpoints for
55+ /// PD must be provided, not the TiKV nodes. It's important to include more than one PD endpoint
56+ /// (include all endpoints, if possible), this helps avoid having a single point of failure.
5357 ///
5458 /// # Examples
59+ ///
5560 /// ```rust,no_run
5661 /// # use tikv_client::{Config, RawClient};
5762 /// # use futures::prelude::*;
63+ /// # use std::time::Duration;
5864 /// # futures::executor::block_on(async {
59- /// let client = RawClient::new(vec!["192.168.0.100"]).await.unwrap();
65+ /// let client = RawClient::new_with_config(
66+ /// vec!["192.168.0.100"],
67+ /// Config::default().with_timeout(Duration::from_secs(60)),
68+ /// ).await.unwrap();
6069 /// # });
6170 /// ```
6271 pub async fn new_with_config < S : Into < String > > (
@@ -72,22 +81,27 @@ impl Client {
7281 } )
7382 }
7483
75- /// Set the column family of requests.
76- ///
77- /// This function returns a new `Client`, requests created with it will have the
78- /// supplied column family constraint. The original `Client` can still be used.
84+ /// Create a new client which is a clone of `self`, but which uses an explicit column family for
85+ /// all requests.
7986 ///
80- /// By default, raw client uses the `Default` column family.
87+ /// This function returns a new `Client`; requests created with the new client will use the
88+ /// supplied column family. The original `Client` can still be used (without the new
89+ /// column family).
8190 ///
82- /// For normal users of the raw API, you don't need to use other column families .
91+ /// By default, raw clients use the `Default` column family .
8392 ///
8493 /// # Examples
94+ ///
8595 /// ```rust,no_run
8696 /// # use tikv_client::{Config, RawClient, ColumnFamily};
8797 /// # use futures::prelude::*;
8898 /// # use std::convert::TryInto;
8999 /// # futures::executor::block_on(async {
90- /// let client = RawClient::new(vec!["192.168.0.100"]).await.unwrap().with_cf(ColumnFamily::Write);
100+ /// let client = RawClient::new(vec!["192.168.0.100"])
101+ /// .await
102+ /// .unwrap()
103+ /// .with_cf(ColumnFamily::Write);
104+ /// // Fetch a value at "foo" from the Write CF.
91105 /// let get_request = client.get("foo".to_owned());
92106 /// # });
93107 /// ```
@@ -411,11 +425,11 @@ impl Client {
411425 ///
412426 /// Once resolved this request will result in a set of scanners over the given keys.
413427 ///
414- /// **Warning**: This method is experimental. The `each_limit` parameter does not work as expected.
415- /// It does not limit the number of results returned of each range,
428+ /// **Warning**: This method is experimental.
429+ /// The `each_limit` parameter does not limit the number of results returned of each range,
416430 /// instead it limits the number of results in each region of each range.
417- /// As a result, you may get **more than** `each_limit` key-value pairs for each range.
418- /// But you should not miss any entries.
431+ /// As a result, you may get **more than** `each_limit` key-value pairs for each range,
432+ /// but you should not miss any entries.
419433 ///
420434 /// # Examples
421435 /// ```rust,no_run
0 commit comments