Skip to content

Adorid/protobuf-demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

about protocol buffer

Protocol Buffers  |  Google Developers https://developers.google.com/protocol-buffers/

dependencies

  • protoc for compiling proto files
  • protobuf==3.2.0 for handing pb in python

general proto file document

proto2 https://developers.google.com/protocol-buffers/docs/proto proto3 https://developers.google.com/protocol-buffers/docs/proto3

python documents

basic usage https://developers.google.com/protocol-buffers/docs/pythontutorial

references https://developers.google.com/protocol-buffers/docs/reference/python/

test protcol buffer

  • if sender has old proto file, receiver has new proto file that has new optional fields. Can receiver access the optional field without checking by HasField(‘xxx’)?

    yes. as long as the server has the new proto file, it’s okay to access the field directly without checking. you will get default value for the type.

    also check HasField’s document. I think it’s only used for duck typing at runtime.

About

protocol buffer demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 84.2%
  • Makefile 15.8%