All Projects → tikv → Client Rust

tikv / Client Rust

Licence: apache-2.0
Rust Client for TiKV.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Client Rust

Nats.rb
Ruby client for NATS, the cloud native messaging system.
Stars: ✭ 850 (+385.71%)
Mutual labels:  client, cncf
Beefun Pro
Github client for iOS in Swift.
Stars: ✭ 172 (-1.71%)
Mutual labels:  client
Remotemonitor
本项目是一个利用HslCommunication组件读取PLC的示例项目,演示了后台从PLC循环读取到前台显示,并推送给在线客户端,客户端同步显示并画实时曲线图。支持web端同步的数据显示,支持web端远程操作PLC,安卓端数据显示,远程操作PLC
Stars: ✭ 160 (-8.57%)
Mutual labels:  client
Bt
BitTorrent library and client with DHT, magnet links, encryption and more
Stars: ✭ 2,011 (+1049.14%)
Mutual labels:  client
Shackle
High-Performance Erlang Network Client Framework
Stars: ✭ 163 (-6.86%)
Mutual labels:  client
Specification
Serverless Workflow Specification
Stars: ✭ 166 (-5.14%)
Mutual labels:  cncf
Restrequest4delphi
API to consume REST services written in any programming language with support to Lazarus and Delphi
Stars: ✭ 162 (-7.43%)
Mutual labels:  client
Hors
instant coding answers via the command line (howdoi in rust)
Stars: ✭ 174 (-0.57%)
Mutual labels:  client
Slash
Slack terminal client.
Stars: ✭ 164 (-6.29%)
Mutual labels:  client
Chronus
Chronus是360金融技术团队基于阿里开源项目TBSchedule重写的分布式调度。
Stars: ✭ 166 (-5.14%)
Mutual labels:  cncf
Swiftyinsta
Instagram Private API Swift
Stars: ✭ 165 (-5.71%)
Mutual labels:  client
Xmpp.js
XMPP for JavaScript
Stars: ✭ 2,006 (+1046.29%)
Mutual labels:  client
Postgres
Postgres.js - The Fastest full featured PostgreSQL client for Node.js
Stars: ✭ 2,193 (+1153.14%)
Mutual labels:  client
Pysnow
Python library for the ServiceNow REST API
Stars: ✭ 162 (-7.43%)
Mutual labels:  client
Earth Reverse Engineering
Reversing Google's 3D satellite mode
Stars: ✭ 2,083 (+1090.29%)
Mutual labels:  client
Httpie Go
httpie-like HTTP client written in Go
Stars: ✭ 162 (-7.43%)
Mutual labels:  client
Unity Fastpacedmultiplayer
Features a Networking Framework to be used on top of Unity Networking, in order to implement an Authoritative Server with Lag Compensation, Client-Side Prediction/Server Reconciliation and Entity Interpolation
Stars: ✭ 162 (-7.43%)
Mutual labels:  client
Objcmongodb
Mac OS and iOS library for MongoDB and BSON
Stars: ✭ 166 (-5.14%)
Mutual labels:  client
Operators
Collection of Kubernetes Operators built with KUDO.
Stars: ✭ 175 (+0%)
Mutual labels:  cncf
Go Clickhouse
Golang ClickHouse connector
Stars: ✭ 174 (-0.57%)
Mutual labels:  client

TiKV Client (Rust)

Build Status

Currently this crate is experimental and some portions (e.g. the Transactional API) are still in active development. You're encouraged to use this library for testing and to help us find problems!

Docs

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. It uses async/await internally and exposes some async fn APIs as well.

This is an open source (Apache 2) project hosted by the Cloud Native Computing Foundation (CNCF) and maintained by the TiKV Authors. We'd love it if you joined us in improving this project.

Getting started

The TiKV client is a Rust library (crate). To use this crate in your project, add following dependencies in your Cargo.toml:

[dependencies]
tikv-client = { git = "https://github.com/tikv/client-rust.git" }

The client requires a Git dependency until we can publish it.

The client provides two modes to interact with TiKV: raw and transactional. In the current version (0.0.0), the transactional API supports optimistic transactions. Pessimistic transactions are implemented but not well tested.

Important note: It is not recommended or supported to use both the raw and transactional APIs on the same database.

Code examples

Raw mode:

let config = Config::new(vec!["127.0.0.1:2379"]);
let client = RawClient::new(config).await?;
client.put("key".to_owned(), "value".to_owned()).await;
let value = client.get("key".to_owned()).await;

Transactional mode:

let config = Config::new(vec!["127.0.0.1:2379"]);
let txn_client = TransactionClient::new(config).await?;
let mut txn = txn_client.begin().await?;
txn.put("key".to_owned(), "value".to_owned()).await?;
let value = txn.get("key".to_owned()).await;
txn.commit().await?;

There are some examples which show how to use the client in a Rust program.

API

Raw requests

Request Main parameter type Successful result type Noteworthy Behavior
put KvPair ()
get Key Option<Value>
delete Key ()
scan BoundRange Vec<KvPair>
batch_put Iter<KvPair> ()
batch_get Iter<Key> Vec<KvPair> Skip non-existent keys; Does not retain order
batch_delete Iter<Key> ()
delete_range BoundRange ()

Transactional requests

Request Main parameter type Successful result type Noteworthy Behavior
put KvPair ()
get Key Option<value>
key_exists Key bool
delete Key ()
scan BoundRange Iter<KvPair>
scan_keys BoundRange Iter<Key>
batch_get Iter<Key> Iter<KvPair> Skip non-existent keys; Does not retain order
lock_keys Iter<Key> ()
gc Timestamp bool It returns whether the latest safepoint in PD equals the parameter

For detailed behavior of each request, please refer to the doc.

Experimental raw requests

You must be careful if you want to use the following request(s). Read the description for reasons.

Request Main parameter type Successful result type
batch_scan Iter<BoundRange> Vec<KvPair>

The each_limit parameter does not work as expected. It does not limit the number of results returned of each range, instead it limits the number of results in each region of each range. As a result, you may get more than each_limit key-value pairs for each range. But you should not miss any entries.

The results of batch_scan are flattened. The order of ranges is retained.

Useful types

To use the client, there are 4 types you will need.

Key is simply a vector of bytes(Vec<u8>). String and Vec<u8> implements Into<Key>, so you can directly pass them to clients.

Value is just an alias of Vec<u8>.

KvPair is a tuple consisting of a Key and a Value. It also provides some convenience methods for conversion to and from other types.

BoundRange is used for range related requests like scan. It implements From for usual ranges so you can just create a range and pass them to the request.For instance, client.scan("k2".to_owned()..="k5".to_owned(), 5) or client.delete_range(vec![]..).

Access the documentation

We've done our best to include ample, tested, and understandable examples.

We recommend using the officially maintained documentation here.

You can also access the documentation on your machine by running the following in any project that depends on tikv-client.

cargo doc --package tikv-client --open
# If it didn't work, browse file URL it tried to open with your browser.

Minimal Rust version

This crate supports Rust 1.40 and above.

For development, a nightly Rust compiler is needed to compile the tests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].