GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing protobuf.dev — Overview OverviewProtobuf is a language-neutral, platform-neutral extensible mechanism for serializing structured data. It’s like JSON, except it’s smaller and faster, and it generates native language bindings. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. Protobuf is a combination of the definition language (created in What Problems Does Protobuf Solve?Protobuf provides a serialization format for packets of typed, structured data that are up to a few megabytes in size. The format is suitable for both ephemeral network traffic and long-term data storage. Protobuf can be extended with new information without invalidating existing data or requiring code to be updated. Protobuf is the most commonly-used data format at Google. It is used extensively
in inter-server communications as well as for archival storage of data on disk.
Protobuf messages and services are described by engineer-authored The proto compiler is invoked at build time on Because Protobuf is used extensively across all manner of services at Google and data within messages may persist for some time, maintaining backwards compatibility is crucial. Protobuf allows for the seamless support of changes, including the addition of new fields and the deletion of existing fields, to any Protobuf message without breaking existing services. For more on this topic, see Updating Proto Definitions Without Updating Code, later in this topic. What Are the Benefits of Using Protobuf?Protobuf is ideal for any situation in which you need to serialize structured, record-like, typed data in a language-neutral, platform-neutral, extensible manner. It is most often used for defining communications protocols (together with gRPC) and for data storage. Some of the advantages of using Protobuf include:
Cross-language CompatibilityThe same messages can be read by code written in any supported programming
language. You can have a Java program on one platform capture data from one
software system, serialize it based on a The following languages are supported directly in the Protobuf compiler, protoc: The following languages are supported by Google, but the projects’ source code resides in GitHub repositories. The protoc compiler uses plugins for these languages: Additional languages are not directly supported by Google, but rather by other GitHub projects. These languages are covered in Third-Party Add-ons for Protobuf. Cross-project SupportYou can use Protobuf across projects by defining A couple of examples of proto definitions widely-used within Google are
Updating Proto Definitions Without Updating CodeIt’s standard for software products to be backward compatible, but it is less
common for them to be forward compatible. As long as you follow some
simple practices
when updating New code will also transparently read old messages. New fields will not be present in old messages; in these cases Protobuf provides a reasonable default value. When Is Protobuf Not a Good Fit?Protobuf does not fit all data. In particular:
Who Uses Protobuf?Many projects use Protobuf, including the following: How Does Protobuf Work?The following diagram shows how you use Protobuf to work with your data.
The code generated by Protobuf provides utility methods to retrieve data from files and streams, extract individual values from the data, check if data exists, serialize data back to a file or stream, and other useful functions. The following code samples show you an example of this flow in Java. As shown
earlier, this is a Compiling this You can then deserialize data using the methods Protobuf creates in other languages, like C++: Protobuf Definition SyntaxWhen defining After setting the cardinality of a field, you specify the data type. Protobuf supports the usual primitive data types, such as integers, booleans, and floats. For the full list, see Scalar Value Types. A field can also be of:
Messages can allow extensions to define fields outside of the message, itself. For example, the Protobuf library’s internal message schema allows extensions for custom, usage-specific options. For more information about the options available, see the language guide for proto2, proto3, or edition 2023. After setting cardinality and data type, you choose a name for the field. There are some things to keep in mind when setting field names:
After assigning a name to the field, you assign a field number. Field numbers cannot be repurposed or reused. If you delete a field, you should reserve its field number to prevent someone from accidentally reusing the number. Additional Data Type SupportProtobuf supports many scalar value types, including integers that use both variable-length encoding and fixed sizes. You can also create your own composite data types by defining messages that are, themselves, data types that you can assign to a field. In addition to the simple and composite value types, several common types are published. HistoryTo read about the history of the Protobuf project, see History of Protobuf. Protobuf Open Source PhilosophyProtobuf was open sourced in 2008 as a way to provide developers outside of Google with the same benefits that we derive from it internally. We support the open source community through regular updates to the language as we make those changes to support our internal requirements. While we accept select pull requests from external developers, we cannot always prioritize feature requests and bug fixes that don’t conform to Google’s specific needs. Developer CommunityTo be alerted to upcoming changes in Protobuf and to connect with Protobuf developers and users, join the Google Group. Additional Resources |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |