Custom field types¶
Advanced feature
This is an advanced feature for extending the library and is not intended for normal use.
Incomplete documentation
Record descriptor¶
API¶
Describes how records should be read, written, accumulated, and merged. Not a «real» Python descriptor.
write
instance-attribute
¶
Write a complete value to the stream, altogether with its tag.
read
instance-attribute
¶
Read a record from the stream.
This behaves differently from the write
,
because it's only supposed to read a single record from the stream
(it may be, for example, just one item of a packed repeated field).
Also, it assumes that the tag has already been read by BaseMessage
.
accumulate
instance-attribute
class-attribute
¶
Accumulate a value from the stream into an existing field value.
It follows the read
to decide which value should be assigned to the attribute.
merge
instance-attribute
class-attribute
¶
Merge two values of the same field from different messages. Only called in a message merger.
__PREDEFINED__
class-attribute
¶
Pre-defined descriptors for primitive types.