|
1 | 1 | // Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0.
|
2 | 2 |
|
3 |
| -// Long and nested future chains can quickly result in large generic types. |
4 |
| -#![type_length_limit = "16777216"] |
5 |
| -#![allow(clippy::redundant_closure)] |
6 |
| -#![allow(clippy::type_complexity)] |
7 |
| -#![allow(incomplete_features)] |
8 |
| - |
9 |
| -//! This crate provides a clean, ready to use client for [TiKV](https://github.com/tikv/tikv), a |
10 |
| -//! distributed transactional Key-Value database written in Rust. |
| 3 | +//! This crate provides an easy-to-use client for [TiKV](https://github.com/tikv/tikv), a |
| 4 | +//! distributed, transactional key-value database written in Rust. |
11 | 5 | //!
|
12 |
| -//! With this crate you can easily connect to any TiKV deployment, interact with it, and mutate the |
13 |
| -//! data it contains. |
| 6 | +//! This crate lets you connect to a TiKV cluster and use either a transactional or raw (simple |
| 7 | +//! get/put style without transactional consistency guarantees) API to access and update your data. |
14 | 8 | //!
|
15 | 9 | //! ## Choosing an API
|
16 | 10 | //!
|
17 | 11 | //! This crate offers both [**raw**](raw/index.html) and
|
18 | 12 | //! [**transactional**](transaction/index.html) APIs. You should choose just one for your system.
|
19 | 13 | //!
|
20 |
| -//! The *consequence* of supporting transactions is increased overhead of coordination with the |
21 |
| -//! placement driver for timestamp acquisition. This is approximately 1 RTT. |
| 14 | +//! The consequence of supporting transactions is increased overhead of coordination with the |
| 15 | +//! placement driver and TiKV, and additional code complexity. |
22 | 16 | //!
|
23 | 17 | //! *While it is possible to use both APIs at the same time, doing so is unsafe and unsupported.*
|
24 | 18 | //!
|
25 |
| -//! Choose the one that suites your needs as described below, then add the import statement to your |
26 |
| -//! file where you need to use the library. |
27 |
| -//! |
28 | 19 | //! ### Transactional
|
29 | 20 | //!
|
30 |
| -//! The [transactional](transaction/index.html) API supports **transactions** via Multi-Version |
31 |
| -//! Concurrency Control (MVCC). |
| 21 | +//! The [transactional](transaction/index.html) API supports **transactions** via multi-version |
| 22 | +//! concurrency control (MVCC). |
32 | 23 | //!
|
33 |
| -//! **Best when you mostly do** complex sets of actions, actions which may require a rollback, |
34 |
| -//! operations affecting multiple keys or values, or operations that depend on strong ordering. |
| 24 | +//! Best when you mostly do complex sets of actions, actions which may require a rollback, |
| 25 | +//! operations affecting multiple keys or values, or operations that depend on strong consistency. |
35 | 26 | //!
|
36 |
| -//! ```rust |
37 |
| -//! use tikv_client::*; |
38 |
| -//! ``` |
39 | 27 | //!
|
40 | 28 | //! ### Raw
|
41 | 29 | //!
|
42 |
| -//! The [raw](raw/index.html) API has **reduced coordination overhead**, but lacks any |
| 30 | +//! The [raw](raw/index.html) API has reduced coordination overhead, but lacks any |
43 | 31 | //! transactional abilities.
|
44 | 32 | //!
|
45 |
| -//! **Best when you mostly do** single row changes, and have very limited cross-row (eg. foreign |
46 |
| -//! key) requirements. You will not be able to use transactions with this API. |
47 |
| -//! |
48 |
| -//! ```rust |
49 |
| -//! use tikv_client::*; |
50 |
| -//! ``` |
51 |
| -//! |
52 |
| -//! ## Connect |
53 |
| -//! |
54 |
| -//! Regardless of which API you choose, you'll need to connect your client |
55 |
| -//! ([raw](raw::Client), [transactional](transaction::Client)). |
56 |
| -//! |
57 |
| -//! ```rust,no_run |
58 |
| -//! # use tikv_client::*; |
59 |
| -//! # use futures::prelude::*; |
60 |
| -//! |
61 |
| -//! # futures::executor::block_on(async { |
62 |
| -//! // Configure endpoints and optional TLS. |
63 |
| -//! let config = Config::default().with_security("root.ca", "internal.cert", "internal.key"); |
64 |
| -//! |
65 |
| -//! // Get a transactional client. |
66 |
| -//! let client = TransactionClient::new_with_config( |
67 |
| -//! vec![ |
68 |
| -//! // A list of PD endpoints. |
69 |
| -//! "192.168.0.100:2379", |
70 |
| -//! "192.168.0.101:2379", |
71 |
| -//! ], config).await.unwrap(); |
72 |
| -//! # }); |
73 |
| -//! ``` |
74 |
| -//! |
75 |
| -//! At this point, you should seek the documentation in the related API modules. |
| 33 | +//! Best when you mostly do single value changes, and have very limited cross-value |
| 34 | +//! requirements. You will not be able to use transactions with this API. |
76 | 35 |
|
77 | 36 | #[macro_use]
|
78 | 37 | mod request;
|
@@ -117,6 +76,4 @@ pub use crate::transaction::{
|
117 | 76 | #[doc(inline)]
|
118 | 77 | pub use config::Config;
|
119 | 78 | #[doc(inline)]
|
120 |
| -pub use region::{Region, RegionId, RegionVerId, StoreId}; |
121 |
| -#[doc(inline)] |
122 | 79 | pub use tikv_client_common::{security::SecurityManager, Error, Result};
|
0 commit comments