Aller au contenu
uencoder

Spécification Protocol Buffers

Protocol Buffers sont Google's language-neutral, platform-neutral binary serialization formater avec .proto schemas.

Schema and Encoding

Protocol Buffers use .proto schema files defining messages with typed fields. Fields are encoded as tag-length-value triples in a compact binary format. Varint encoding compresses small integers efficiently. Repeated, optional, and map fields are supported. The format is not self-describing; the schema is needed to decode. Proto3 simplifies the syntax by removing required fields and explicit defaults.

.proto schema
Field definitions
message Person { ... }
TLV encoding
Tag-length-value
compact binary
varint
Variable-length ints
small ints = 1 byte

Evolution and Ecosystem

Protobuf supports forward and backward compatibility by following field-number rules. New fields can be added; old fields can be reserved but not reused. gRPC uses protobuf for service definitions and wire format. The format is used across Google APIs and many microservice architectures. Code generators produce typed bindings for 15+ languages. Protobuf is the dominant RPC serialization format.

compatibility
Add fields freely
never reuse numbers
gRPC
Service definitions
HTTP/2 transport
codegen
15+ languages
typed bindings

Outils associés

参考链接