Book Image

Protocol Buffers Handbook

By : Clément Jean
Book Image

Protocol Buffers Handbook

By: Clément Jean

Overview of this book

Explore how Protocol Buffers (Protobuf) serialize structured data and provides a language-neutral, platform-neutral, and extensible solution. With this guide to mastering Protobuf, you'll build your skills to effectively serialize, transmit, and manage data across diverse platforms and languages. This book will help you enter the world of Protocol Buffers by unraveling the intricate nuances of Protobuf syntax and showing you how to define complex data structures. As you progress, you’ll learn schema evolution, ensuring seamless compatibility as your projects evolve. The book also covers advanced topics such as custom options and plugins, allowing you to tailor validation processes to your specific requirements. You’ll understand how to automate project builds using cutting-edge tools such as Buf and Bazel, streamlining your development workflow. With hands-on projects in Go and Python programming, you’ll learn how to practically apply Protobuf concepts. Later chapters will show you how to integrate data interchange capabilities across different programming languages, enabling efficient collaboration and system interoperability. By the end of this book, you’ll have a solid understanding of Protobuf internals, enabling you to discern when and how to use and redefine your approach to data serialization.
Table of Contents (13 chapters)

Quiz

  1. Where can you find the proto files for the well-known types?
    1. Nowhere; this is hidden inside the Protobuf language.
    2. Nowhere; we need to define them ourselves.
    3. On the GitHub repository under the src/google/protobuf folder.
  2. Where can you find the message definitions for the option types?
    1. On the GitHub repository under the folder src/google/protobuf in the file called descriptor.proto.
    2. Nowhere; this is hidden inside the Protobuf language.
    3. Nowhere; we need to define them ourselves.
  3. Why do we define an UNSPECIFIED value in enums for proto3?
    1. In proto3, enums are closed, so we do not need to.
    2. In proto3, enums are open, and UNSPECIFIED is used as the default value.
    3. It is not needed in proto3, only in proto2.
  4. When do we need nesting types inside a message?
    1. When we want to specialize a type with fully qualified names.
    2. When a type is only relevant in the parent context.
    3. All the above.