官术网_书友最值得收藏!

Protocol Buffers

Protocol Buffers are a Google product, and they have just entered their third revision. Protocol Buffers take the approach of providing a DSL that the generator (written in C) reads and can generate client and server stubs for over ten languages, the primary ten are maintained by Google and encompass: Go, Java, C, JavaScript for NodeJS.

Protocol Buffers is a pluggable architecture, so it is possible to write your own plugins to generate all kinds of endpoints not just RPC; however, RPC is the main use case as they are coupled to the gRPC framework.

gRPC was designed by Google to be a fast and language agnostic RPC framework, which originated from an internal project where latency and speed were of the utmost importance in Google's architecture. By default, gRPC uses protocol buffers as the method for serializing and de-serializing structured data. An example of this DSL is shown in the following example.

Protocol buffer service definition:

service Users { 
rpc CreateUser (User) returns (Error) {}
}

message User {
required string name = 1;
required int32 id = 2;
optional string email = 3;
}

message Error {
optional code int32 = 1
optional detail string = 2
}

Find more information on Protocol Buffers at https://developers.google.com/protocol-buffers/.

主站蜘蛛池模板: 无极县| 米脂县| 从化市| 珠海市| 碌曲县| 额尔古纳市| 深州市| 玉山县| 江津市| 江津市| 株洲县| 桐城市| 梨树县| 曲阳县| 白沙| 陇川县| 和平县| 亳州市| 井研县| 平顶山市| 洞口县| 铁力市| 时尚| 桦川县| 梁河县| 杨浦区| 拜城县| 洪湖市| 天祝| 石门县| 菏泽市| 昌吉市| 饶阳县| 沾化县| 科技| 平原县| 达日县| 亳州市| 丘北县| 军事| 永嘉县|