A brief introduction to protobuf Protobuf is Google's open source serialization protocol framework, which has a structure similar to XML and JSON. Its notable features are binary and high efficiency. It is mainly used in communication protocols and data storage, and is considered a method of representing structured data. Advantages of protobuf
Disadvantages of protobuf
XML is self-describing, but protobuf format is not. If you are given a binary file, you cannot tell what it does. Protobuf usage steps
For example, define a structured data person, including name and email attributes Defined in xml <person> <name>zhangsan</name> <email>[email protected]</email> <person> protobuf defines this person{ name:"zhangsan" email:"[email protected]" } This is defined in json { "person":{ "name":"zhangsan", "email":"[email protected]" } } Syntax of protobuf Message definition A message type defines a request or response message format and can contain multiple types. Service If you need to use the message type on RPC, you need to define an RPC service interface in the .proto file. The protocol buffer compiler will generate service interface code based on the selected language. Protobuf is installed in Ubuntu [version 16.04] Official address: https://github.com/google/protobuf/blob/master/src/README.md The installation command line is as follows: $ sudo apt-get install autoconf automake libtool curl make g++ unzip $ git clone https://github.com/google/protobuf.git $ cd protobuf $ git submodule update --init --recursive $ ./autogen.sh $ ./configure $ make $ make check $ sudo make install $ sudo ldconfig # refresh shared library cache. Screenshot after make The compilation went smoothly without any problems. Let's check the version below. Summarize The above is a brief introduction to protobuf and the installation tutorial in Ubuntu 16.04 environment. I hope it will be helpful to everyone. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
>>: Detailed explanation of common usage methods of weixin-js-sdk in vue
1. Only Chinese characters can be input and pasted...
Table of contents question Solution question Ther...
Table of contents Preparation Install VMware Work...
Table of contents Preface🌟 1. API Introduction 2....
border-radius:10px; /* All corners are rounded wi...
How to use the concat function in MySQL: CONCAT(s...
join() method: connects all elements in an array ...
1. Check the character set of the database The ch...
Table of contents How to install and configure To...
1. Problem Description root@mysqldb 22:12: [xucl]...
The specific code for using jQuery to implement t...
Preface We often need to do something based on so...
Development Background: Recently, I am working on...
Table of contents Code: Replenish: Summarize Requ...
Preface Only Innodb and MyISAM storage engines ca...