The Protocol Buffers data types for NN protocols that use PB go in this package.

Steps to add a new protocol


  1. Define the protobuf service for the protocol in <ProtocolName>.proto class.
  2. Generate java files from the proto file using protoc tool.
  3. Define server side interface that extends BlockingInterface from the generated files (Example: NamenodeProtocolService.BlockingInterface) and VersionedProtocol. See NamenodePBProtocol.java for example.
  4. Define client side translator to translate the client protocol to protobuf. See NamenodeProtocolTranslator.
  5. Define server side implementation that implements the server side interface. This implementation receives the protobuf requests and delegates it to the server side implementation. See NamenodePBProtocolImpl for example.
  6. Make changes to register this protocol at the server. See the other protocols on how this is done.

Steps to make changes to the existing protocol in a compatible way


  1. Adding new methods is a compatible change.
  2. When modifying an existing method, do not change the required parameters to optional or optional parameters to required. Only add optional parameters to the request and response.
  3. When modifying an existing type, do not change the required parameters to optional or optional parameters to require and optional parameters to required. Only add optional parameters to the request and response.