liveBook · Manning

Forward compatibility

As explained in Learn Go with Pocket-Sized Projects

Forward compatibility is the ability of existing implementations to continue working when a service or data interface gains supported additions.

Forward compatibility keeps existing gRPC server implementations working when a .proto service gains a new endpoint. Generated Go code enforces this by requiring server implementations to embed a generated type. section 10.1.2

The generated server interface supports two approaches:

  • Require implementations to embed the generated unimplemented-server type, preserving compatibility when methods are added. section 10.1.2
  • Permit implementations not to implement the required server interface by setting require_unimplemented_servers=false; this option is available but not recommended. section 10.1.2

How Learn Go with Pocket-Sized Projects covers it

How deep it goes
Explains the generated-interface mechanism and its alternative compiler option, but stops short of showing implementation code.
Examples
Uses adding a new endpoint, regenerating Go files, embedding a generated type, and the protoc generation command.
What it assumes
Assumes familiarity with Go implementations, gRPC services, .proto files, and generated source files.
What you can do after
Operate/configure protoc to regenerate compatible Go gRPC services after extending a .proto definition.
How it connects
Connects gRPC service interfaces with Protocol Buffers, code generation, and API evolution.

Also explained in

Compare how 5 books explain forward compatibility →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Go with Pocket-Sized Projects. The section links point to the parts of the book it draws on.