This crate provides a clean, ready to use client for TiKV, a distributed transactional Key-Value database written in Rust.
With this crate you can easily connect to any TiKV deployment, interact with it, and mutate the data it contains.
The consequence of supporting transactions is increased overhead of coordination with the placement driver for timestamp acquisition. This is approximately 1 RTT.
While it is possible to use both APIs at the same time, doing so is unsafe and unsupported.
Choose the one that suites your needs as described below, then add the import statement to your file where you need to use the library.
The transactional API supports transactions via Multi-Version Concurrency Control (MVCC).
Best when you mostly do complex sets of actions, actions which may require a rollback, operations affecting multiple keys or values, or operations that depend on strong ordering.
The raw API has reduced coordination overhead, but lacks any transactional abilities.
Best when you mostly do single row changes, and have very limited cross-row (eg. foreign key) requirements. You will not be able to use transactions with this API.
// Configure endpoints and optional TLS. let config = Config::default().with_security("root.ca", "internal.cert", "internal.key"); // Get a transactional client. let client = TransactionClient::new_with_config( vec![ // A list of PD endpoints. "192.168.0.100:2379", "192.168.0.101:2379", ], config).await.unwrap();
At this point, you should seek the documentation in the related API modules.
This module contains utility types and functions for making the transition from futures 0.1 to 1.0 easier.
Raw related functionality.
A timestamp returned from the timestamp oracle.
Transactional related functionality.
When a request is retried, we can backoff for some time to avoid saturating the network.
A struct for expressing ranges. This type is semi-opaque and is not really meant for users to
deal with directly. Most functions which operate on ranges will accept any types which
The configuration for either a
The key part of a key/value pair.
A key/value pair.
The TiKV raw
Information about a TiKV region and its leader.
The ID and version information of a region.
Manages the TLS protocol
A read-only transaction which reads at the given timestamp.
An undo-able set of actions on the dataset.
The TiKV transactional
Options for configuring a transaction.
An error originating from the TiKV client or dependencies.
A convenience trait for converting ranges of borrowed types into a
A helper trait to convert a Timestamp to and from an u64.
The ID of a region
A result holding an
The ID of a store
The value part of a key/value pair. An alias for