Skip to content

Provide protocol version

D3M bot requested to merge protocol-version into master

Fixes: #14 (closed)

This is the best way I have found to specify a protocol version. There seems to not be any way to provide an automatic constant value in a message, but you can add custom values at different levels of the protocol specification. This is called options. In this case, I am adding a value at the file level. The idea is that then you use this value when sending a message. So if you recompile the proto file, you will always be sending the version from that file.

In Python, you can get the value by:

import pipeline_service_pb2
version = pipeline_service_pb2.DESCRIPTOR.GetOptions().Extensions[pipeline_service_pb2.protocol_version]

See more information here (proto2 documentation still holds for this feature).

Also reported upstream: https://github.com/google/protobuf/issues/3520

Edited by D3M bot

Merge request reports