• Stars
    star
    1,775
  • Rank 25,267 (Top 0.6 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The gRPC library for Rust built on C Core library and futures

gRPC-rs

gRPC-rs is a Rust wrapper of gRPC Core. gRPC is a high performance, open source universal RPC framework that puts mobile and HTTP/2 first.

Crates.io docs.rs Build Status Build Status

Status

This project is still under development. The following features with the check marks are supported:

  • Basic asynchronous unary/steaming call
  • SSL
  • Generic call
  • Connection level compression
  • Interoperability test
  • QPS benchmark
  • Custom metadata
  • Health check
  • Reflection
  • Authentication
  • Load balance, client side is fully supported, server side load report is not implemented yet.

Prerequisites

  • CMake >= 3.8.0
  • Rust >= 1.36.0
  • binutils >= 2.22
  • LLVM and Clang >= 3.9 if you need to generate bindings at compile time.

For Linux and MacOS, you also need to install gcc 4.9+ (or clang) too.

Bindings are pre-generated for x86_64/arm64 Linux. For other platforms, bindings are generated at compile time.

For Windows, you also need to install following software:

  • Active State Perl
  • yasm
  • Visual Studio 2015+

Build

$ cargo xtask submodule # if you just cloned the repository
$ cargo build

Error linking OpenSSL

If you're getting linker errors when building your project using gRPC-rs, head down to the openssl feature section for a possible fix.

Usage

To generate the sources from proto files:

Option 1 - Manual Generation

  1. Install the protobuf compiler:
$ cargo install protobuf-codegen
  1. Install the gRPC compiler:
$ cargo install grpcio-compiler
  1. Generate the sources:
$ protoc --rust_out=. --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_rust_plugin` example.proto

Option 2 - Programmatic Generation

Programmatic generation can be used to generate Rust modules from proto files via your build.rs by using protoc-grpcio.

For more information and examples see README.

To include this project as a dependency:

[dependencies]
grpcio = "0.12"

Feature boringssl

boringssl feature enables support for TLS encryption and some authentication mechanism. When you do not need it, for example when working in intranet, you can disable it by using the following configuration:

[dependencies]
grpcio = { version = "0.12", default-features = false, features = ["protobuf-codec"] }

Feature prost-codec and protobuf-codec

gRPC-rs uses protobuf crate by default. If you want to use prost instead, you can enable prost-codec feature. You probably only want to enable only one of the two features. Though grpcio is completely fine with both features enabled at the same time, grpcio-compiler will not going to work as expected.

Feature openssl and openssl-vendored

gRPC-rs comes vendored with gRPC Core, which by default uses BoringSSL instead of OpenSSL. This may cause linking issues due to symbol clashes and/or missing symbols when another one of your dependencies uses OpenSSL. To resolve this, you can tell gRPC-rs to use OpenSSL too by specifying "openssl" in your Cargo.toml's features list for gprcio, which requires openssl (>=1.0.2). E.g.:

[dependencies]
grpcio = { version = "0.12", features = ["openssl"] }

Feature openssl-vendored is the same as feature openssl except it will build openssl from bundled sources.

Performance

See benchmark to find out how to run a benchmark by yourself.

Cross Compile

See cross_compile

Contributing

Make sure to format and test the code before sending a PR.

If the content in grpc-sys/grpc is updated, you may need to regenerate bindings:

$ cargo xtask bindgen

More Repositories

1

tikv

Distributed transactional key-value database, originally created to complement TiDB
Rust
14,548
star
2

raft-rs

Raft distributed consensus algorithm implemented in Rust.
Rust
2,785
star
3

pprof-rs

A Rust CPU profiler implemented with the help of backtrace-rs
Rust
1,198
star
4

pd

Placement driver for TiKV
Go
1,022
star
5

rust-prometheus

Prometheus instrumentation library for Rust applications
Rust
1,017
star
6

agatedb

A persistent key-value storage in rust.
Rust
793
star
7

minitrace-rust

Extremely fast tracing library for Rust
Rust
659
star
8

raft-engine

A persistent storage engine for Multi-Raft log
Rust
521
star
9

titan

A RocksDB plugin for key-value separation, inspired by WiscKey.
C++
466
star
10

client-rust

Rust Client for TiKV.
Rust
368
star
11

fail-rs

Fail points for rust
Rust
322
star
12

client-go

Go client for TiKV
Go
268
star
13

minstant

Performant time measuring in Rust
Rust
151
star
14

yatp

Yet another thread pool in rust for both callbacks or futures.
Rust
129
star
15

client-java

TiKV Java Client
Java
106
star
16

deep-dive-tikv

How do we build a distributed, transactional key-value database - TiKV?
HTML
97
star
17

rfcs

RFCs for changes to TiKV and its ecosystem
76
star
18

auto-tikv

Tool to tune TiKV with ML method
Python
66
star
19

sig-transaction

Resources for the transaction SIG
61
star
20

async-speed-limit

Asynchronously speed-limiting multiple byte streams
Rust
53
star
21

minitrace-go

A high-performance timeline tracing library for Golang, used by TiDB
Go
45
star
22

community

TiKV community content
43
star
23

client-c

The C++ TiKV client used by TiFlash.
C++
41
star
24

crc64fast

SIMD accelerated CRC-64-ECMA computation
Rust
40
star
25

migration

Migration tools for TiKV, e.g. online bulk load.
Go
34
star
26

tikv-dev-guide

The TiKV development/contribution guide
34
star
27

client-py

Rust
26
star
28

importer

tikv-importer is a front-end to help ingesting large number of KV pairs into a TiKV cluster
Rust
20
star
29

website

Website for tikv.org
HTML
19
star
30

tikv-operator

Go
19
star
31

protobuf-build

Rust
17
star
32

client-cpp

TiKV Client for C++
Rust
15
star
33

client-node

Rust
11
star
34

mur3

Rust implementation of MurmurHash3.
Rust
10
star
35

copr-test

Go
9
star
36

mock-tikv

A mocked TiKV server for testing clients that written in different languages.
Go
6
star
37

slog-global

Global loggers for slog-rs. Similar to slog-scope but more simple.
Rust
5
star
38

match-template

match-template is a procedural macro that generates repeated match arms by pattern.
Rust
5
star
39

jepsen-test

Clojure
5
star
40

terraform-tikv-bench

An Orcestrated TiKV benchmark. Not for production deployment.
HCL
4
star
41

skiplist-rs

Rust
4
star
42

client-validator

Provide functional checks for tikv client implementations in different languages.
Go
3
star
43

tracing-active-tree

Rust
3
star
44

tlaplus-specs

TiKV TLA+ specifications
TLA
3
star