org.apache.hadoop.hdfs.protocolPB.overview.html Maven / Gradle / Ivy
Protocol Buffers based data types for NN protocols
The Protocol Buffers data types for NN protocols that use PB go in this package.
Steps to add a new protocol
- Define the protobuf service for the protocol in <ProtocolName>.proto class.
- This file should include both the protobuf service definition and the types
used for request and response. For example see - NamenodeProtocol.proto
- The naming convention for the protobuf service is <ProtocolName>Service.
Example: NamenodeProtocolService.
- Every RPC method takes a request and returns a response. The request
naming convention is <MethodName>RequestProto. The response naming convention
is <MethodName>ResponseProto.
- Generate java files from the proto file using protoc tool.
- Define server side interface that extends BlockingInterface from the
generated files (Example: NamenodeProtocolService.BlockingInterface)
and VersionedProtocol. See NamenodePBProtocol.java for example.
- Define client side translator to translate the client protocol to
protobuf. See NamenodeProtocolTranslator.
- 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.
- 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
- Adding new methods is a compatible change.
- 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.
- 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.
© 2015 - 2024 Weber Informatics LLC | Privacy Policy