mirror of
https://codeberg.org/JasterV/grpc-slides.git
synced 2026-04-26 18:40:03 +00:00
Update presentation
This commit is contained in:
parent
1f150ce05a
commit
0eba94d0a9
1 changed files with 43 additions and 58 deletions
|
|
@ -56,7 +56,7 @@ They auto-generated the client and server stubs:
|
||||||
---
|
---
|
||||||
### Interface Definition Language
|
### Interface Definition Language
|
||||||
|
|
||||||
```protobuf
|
```thrift
|
||||||
struct Phone {
|
struct Phone {
|
||||||
1: i32 id,
|
1: i32 id,
|
||||||
2: string number,
|
2: string number,
|
||||||
|
|
@ -68,6 +68,10 @@ service PhoneService {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<p style="font-size: 26px;">
|
||||||
|
Codegen tools will generate gRPC stubs from IDL code
|
||||||
|
</p>
|
||||||
|
|
||||||
<p style="font-size: 26px;">
|
<p style="font-size: 26px;">
|
||||||
An example of Thrift, an IDL used in Facebook's RPC framework
|
An example of Thrift, an IDL used in Facebook's RPC framework
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -167,13 +171,13 @@ Can be useful for: Authentication & tracing
|
||||||
---
|
---
|
||||||
### And many more features
|
### And many more features
|
||||||
|
|
||||||
- **Flow control** for streaming
|
|
||||||
- RPC automatic & manual **cancellations**
|
|
||||||
- **Reflection** (Service discoverability & ease debugging)
|
|
||||||
- **Load balancing** (Client requests can be load balanced between multiple servers)
|
|
||||||
- Call **retries**
|
|
||||||
- **Health checking** (Service-specific health checking)
|
- **Health checking** (Service-specific health checking)
|
||||||
- **Interceptors** (Middleware for RPCs)
|
- **Interceptors** (Middleware for RPCs)
|
||||||
|
- **Reflection** (Service discoverability & ease debugging)
|
||||||
|
- RPC automatic & manual **cancellations**
|
||||||
|
- Call **retries**
|
||||||
|
- **Flow control** for streaming
|
||||||
|
- **Load balancing** (Client requests can be load balanced between multiple servers)
|
||||||
|
|
||||||
note:
|
note:
|
||||||
|
|
||||||
|
|
@ -214,6 +218,28 @@ Here we will focus on the IDL and the tooling, we won't focus on the serializati
|
||||||
### Protobufs as an Interface Definition Language
|
### Protobufs as an Interface Definition Language
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Defining messages
|
||||||
|
|
||||||
|
```protobuf
|
||||||
|
// amend_termination/request/v1/request.proto
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package amend_termination.request.v1;
|
||||||
|
|
||||||
|
message AmendTerminationRequest {
|
||||||
|
string policy_id = 1;
|
||||||
|
google.protobuf.Timestamp requested_at = 2;
|
||||||
|
google.protobuf.Timestamp interruption_at = 3;
|
||||||
|
optional string description = 4;
|
||||||
|
oneof reason {
|
||||||
|
CustomerTerminateReason customer = 5;
|
||||||
|
PrimaTerminateReason prima = 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### Defining a service
|
### Defining a service
|
||||||
|
|
||||||
```protobuf
|
```protobuf
|
||||||
|
|
@ -226,33 +252,23 @@ import "amend_termination/request/v1/request.proto";
|
||||||
import "amend_termination/response/v1/response.proto";
|
import "amend_termination/response/v1/response.proto";
|
||||||
|
|
||||||
service PolicyManagementService {
|
service PolicyManagementService {
|
||||||
rpc AmendTermination(amend_termination.request.v1.AmendTerminationRequest) returns (amend_termination.response.v1.AmendTerminationResponse);
|
rpc AmendTermination(AmendTerminationRequest) returns (AmendTerminationResponse);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
### Defining messages
|
|
||||||
|
|
||||||
```protobuf
|
### Remarkable features of Protocol buffers
|
||||||
// amend_termination/request/v1/request.proto
|
|
||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package amend_termination.request.v1;
|
- **Strongly typed** data
|
||||||
|
- **Language** and **platform neutral**
|
||||||
|
- **Compact binary format**
|
||||||
|
- Support for **RPC service definition**
|
||||||
|
- **Backward and Forward compatibility**
|
||||||
|
|
||||||
import "terminate_policy/request/v1/request.proto";
|
note:
|
||||||
import "google/protobuf/timestamp.proto";
|
|
||||||
|
|
||||||
message AmendTerminationRequest {
|
Give a short example of why it is backward and forward compatible. Mention tags.
|
||||||
string policy_id = 1;
|
|
||||||
google.protobuf.Timestamp requested_at = 2;
|
|
||||||
google.protobuf.Timestamp interruption_at = 3;
|
|
||||||
optional string description = 4;
|
|
||||||
oneof reason {
|
|
||||||
terminate_policy.request.v1.CustomerTerminateReason customer = 5;
|
|
||||||
terminate_policy.request.v1.PrimaTerminateReason prima = 6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
### The protoc compiler
|
### The protoc compiler
|
||||||
|
|
@ -289,35 +305,6 @@ Explain that it builds on top of protoc. Be very short here, just mention the to
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Buf CLI
|
|
||||||
|
|
||||||
```bash
|
|
||||||
buf format
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
buf lint
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
buf breaking --against ".git#branch=master"
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
### Remarkable features of Protocol buffers
|
|
||||||
|
|
||||||
- **Strongly typed** data
|
|
||||||
- **Language** and **platform neutral**
|
|
||||||
- **Compact binary format**
|
|
||||||
- **Backward and Forward compatibility**
|
|
||||||
- Support for **RPC service definition**
|
|
||||||
|
|
||||||
note:
|
|
||||||
|
|
||||||
Give a short example of why it is backward and forward compatible. Mention tags.
|
|
||||||
|
|
||||||
---
|
|
||||||
## gRPC in the Rust ecosystem
|
## gRPC in the Rust ecosystem
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -331,9 +318,9 @@ Give a short example of why it is backward and forward compatible. Mention tags.
|
||||||
---
|
---
|
||||||
# Tonic
|
# Tonic
|
||||||
|
|
||||||
<img alt="tonic logo" src="assets/images/tonic.svg" style="width: 200px;" />
|
<img alt="tonic logo" src="assets/images/tonic.svg" style="width: 150px;" />
|
||||||
|
|
||||||
<br />
|
*A gRPC over HTTP/2 rust implementation focused on high performance, interoperability, and flexibility*
|
||||||
|
|
||||||
<a style="font-size: 24px;" href="https://github.com/hyperium/tonic">
|
<a style="font-size: 24px;" href="https://github.com/hyperium/tonic">
|
||||||
https://github.com/hyperium/tonic
|
https://github.com/hyperium/tonic
|
||||||
|
|
@ -341,8 +328,6 @@ https://github.com/hyperium/tonic
|
||||||
|
|
||||||
note:
|
note:
|
||||||
|
|
||||||
Built on top of Tower, Tonic is a gRPC over HTTP/2 implementation focused on **high performance**, **interoperability**, and **flexibility**.
|
|
||||||
|
|
||||||
It has first class support for async/await.
|
It has first class support for async/await.
|
||||||
|
|
||||||
The main goal of tonic is to provide a generic gRPC implementation over HTTP/2 framing.
|
The main goal of tonic is to provide a generic gRPC implementation over HTTP/2 framing.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue