Logo
Section 1 / 2

gRPC API 的类型

了解 gRPC 中的不同流式传输选项。

检查点

gRPC API 的类型

了解 gRPC 中的不同流式传输选项。

...
Unary API

.proto 文件中的 Unary API

1rpc UnaryExample(Request) returns (Response) {}
...
Client Streaming API

.proto 文件中的 Client streaming API

1rpc ClientStreamingExample(stream Request) returns (Response) {}
...
Server Streaming API

.proto 文件中的 Server streaming API

1rpc ServerStreamingExample(Request) returns (stream Response) {}
...
Bidirectional Streaming API

.proto 文件中的 Bidirectional streaming API

1rpc BiDiStreamingExample(stream Request) returns (stream Response) {}

FTPService 中的 RPC 方法

1// FTP 服务定义。 2service FTPService { 3 4 // 删除服务器目标目录中的文件 5 rpc deleteFile (MetaData) returns (Result) {}; 6 7 // 将文件添加到服务器的目标目录中。 8 rpc addFile(stream AddFileRequest) returns(Result){}; 9}
1.

Describe the structure of a server streaming rpc named readFile, which accepts MetaData containing the file name as request and sends FileChunk in response.

0/500
2.

Describe the structure of a bidirectional streaming rpc named findFile, which accepts MetaData containing the file name as request and sends Result in response.

0/500

gRPC streaming APIs

Quiz

单选题

考虑一个 concatenate 方法,该方法接收多个文本字符串并返回一个合并后的单一字符串。根据上述信息,选择相应的流类型。

1 / 2

创建一个 CLI 客户端

gRPC 中的 StreamObserver 接口