grpc-rust README

The project's README from github.com/grpc/grpc-rust. As one markdown file: README.md.

A rust implementation of gRPC, a high performance, open source, general RPC framework that puts mobile and HTTP/2 first.

Note: tonic's master branch is currently preparing breaking changes. For the most recently released code, look to the 0.14.x branch.

tonic is a gRPC over HTTP/2 implementation focused on high performance, interoperability, and flexibility. This library was created to have first class support of async/await and to act as a core building block for production systems written in Rust.

Crates.io Documentation Crates.io

Examples | Website | Docs | Chat

Overview

tonic is composed of three main components: the generic gRPC implementation, the high performance HTTP/2 implementation and the codegen powered by prost. The generic implementation can support any HTTP/2 implementation and any encoding via a set of generic traits. The HTTP/2 implementation is based on hyper, a fast HTTP/1.1 and HTTP/2 client and server built on top of the robust tokio stack. The codegen contains the tools to build clients and servers from protobuf definitions.

Features

Getting Started

Examples can be found in examples and for more complex scenarios interop may be a good resource as it shows examples of many of the gRPC features.

Rust Version

tonic's MSRV is 1.88.

Dependencies

tonic-build uses protoc Protocol Buffers compiler in some APIs which compile Protocol Buffers resource files such as tonic_build::compile_protos().

Getting Help

First, see if the answer to your question can be found in the API documentation. If the answer is not there, there is an active community in the Tonic Discord channel. We would be happy to try to answer your question. If that doesn't work, try opening an issue with the question.

Project Layout

Contributing

:balloon: Thanks for your help improving the project! We are so happy to have you! We have a contributing guide to help you get involved in the Tonic project.

License

This project is licensed under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Tonic by you, shall be licensed as MIT, without any additional terms or conditions.

grpc-rust (grpc/grpc-rust)

Searching Database…

12.5K ·GitHub
Что это такое?tonic — нативная реализация gRPC-клиента и сервера на Rust. Работает поверх HTTP/2 с полноценной поддержкой async/await и задуман как ключевой строительный блок для production-систем на Rust.
Это библиотека, которую я подключаю в свой код, или приложение, которое я разворачиваю?Это библиотека, а не разворачиваемое приложение. В ней три основные части: общая реализация gRPC, быстрая реализация HTTP/2 на основе hyper и tokio, а также генерация кода на базе prost, которая собирает клиентов и серверы из protobuf-определений.
С чего мне начать?Начните с туториала helloworld — базового примера для тех, кто сталкивается с этим впервые, — затем посмотрите routeguide, где разобран полный пример со всеми возможностями. В каталоге examples показаны TLS, балансировка нагрузки и двунаправленный стриминг.
Что мне нужно установить, кроме Rust?Rust 1.88 или новее (заявленный MSRV), а также protoc — компилятор Protocol Buffers, поскольку некоторые API tonic-build, например tonic_build::compile_protos(), используют его для компиляции файлов .proto.
Ветка master сейчас безопасна для сборки?Не совсем: в ветке master сейчас готовятся изменения с нарушением обратной совместимости. Для самого последнего выпущенного кода README отсылает к ветке 0.14.x.
Какие возможности gRPC он поддерживает из коробки?Двунаправленный стриминг, TLS на основе rustls, балансировку нагрузки, пользовательские метаданные, аутентификацию и проверку состояния — и всё это на высокопроизводительном асинхронном вводе-выводе. Набор универсальных трейтов позволяет также работать поверх любой реализации HTTP/2 и с любой кодировкой.
Почему создали tonic, а не взяли готовую gRPC-библиотеку?В README сказано, что его создали ради полноценной поддержки async/await и чтобы он стал ключевым строительным блоком для production-систем на Rust, положив реализацию gRPC поверх стека tokio и hyper.
Может ли он общаться с gRPC-сервисами, написанными на других языках?Да. Совместимость заявлена как одна из целей проектирования, а в репозитории есть отдельный набор interop-тестов, покрывающий многие возможности gRPC, — так что он работает с gRPC-реализациями, соответствующими стандарту.
Что добавляют tonic-health и tonic-reflection?tonic-health реализует стандартный gRPC-сервис проверки состояния (и заодно служит примером unary-вызовов и вызовов с потоковым ответом), tonic-reflection добавляет gRPC reflection, а tonic-types предоставляет утилиты для gRPC Well Known Types.
Creator
grpc
Size
83.6 MB
Stars
12.5K
Age
7y
Commits · 90 Days