Reference Guide

Table Of Contents
A message version is a function of the field numbering and tags provided by GPB and how those
are changed between different iterations of the data structure. The following are general rules
about how .proto fields should be updated to insure compatible GPB versioned data:
· Do not change the numeric tags for any existing (previous version) fields.
· New fields should be tagged OPTIONAL/REPEATED (never REQUIRED). New fields should
also be assigned a new, unique field ID.
· Removal of OPTIONAL/REPEATED tagged fields are allowed and will not affect
compatibility.
· Changing a default value for a field is allowed. (Default values are sent only if the field is
not provided.)
· There are specific rules for changing the field types. Some type conversions are compatible
while others are not (see GPB documentation for specific details).
Note: It is generally advised that the minimal number of fields be marked with a REQUIRED tag as
these fields become fixed in the schema and will always have to be present in future versions of
the message.
.proto Compilation Process
The following is a description of the process by which .proto files should be defined for an
application, compiled with the Java GPB compiler, and how the derived data classes should
be imported and used in application code. Application developers that wish to make use of
GPB in their designs will need to download and install Google Protocol Buffers (GPB) on
their local development machine. Those steps are as follows for GPB 2.5.0v:
Compiling and installing the protoc binary
The protoc binary is the tool used to compile your text-based .proto file into a source file
based on the language of your choice (Java in this example). You will need to follow these
steps if you plan on being able to compile GPB-related code.
1. Download the "full source" of Google's Protocol Buffers. For this example we are
using 2.5.0v in the instructions below.
2. Extract it somewhere locally.
3. Run the following line:
cd protobuf-2.5.0
./configure && make && make check && sudo make install
4. Add the following to your shell profile and also run this command:
export LD_LIBRARY_PATH=/usr/local/lib
5. Try to run it standalone to verify protoc is in your path and the LD_LIBRARY_PATH is
set correctly. Running “protoc” on the command line should return “Missing input
file.” If everything is setup correctly.
Compiling .proto Files
78