Protobuf Decoder
mosaicolabs.bridges.mcap.decoders.protobuf.rules_matcher ¶
ProtobufRulesMatcher ¶
from_descriptor
classmethod
¶
Walks descr's fields (recursing into nested messages) and returns a dict mapping
each field's RulePath to the ordered list of PROTOBUF_RULES entries whose
predicate matches that field (see match_rules) — a field can match more than one,
e.g. a Timestamp field that is also a oneof member matches is_field_timestamp,
is_field_oneof and is_field_singular_message. MCAPMsgDecoderBase._postprocess()
applies them in this same order.
is_field_int64 ¶
Whether field is one of the int64-family protobuf types that need coercion
into a native Python int.
is_field_timestamp ¶
Whether field is a google.protobuf.Timestamp message field.
is_field_nested ¶
Whether field holds a nested message (or group) that should be recursed into.
is_field_singular_message ¶
Whether field is a non-repeated message field. Like oneof members, such fields
have explicit presence, so always_print_fields_with_no_presence doesn't force
MessageToDict to print them when unset (unlike repeated/map fields, which have no
presence and are always printed).
is_field_map ¶
Whether field is a protobuf map<K, V> field. Maps are implemented as a repeated
field of a synthesized MapEntry message (with key/value fields), so this must be
checked before treating a repeated field as an ordinary list.
mosaicolabs.bridges.mcap.decoders.MCAPProtobufMsgDecoder ¶
Bases: MCAPMsgDecoderBase[Message]
supported_encoding
classmethod
¶
The channel.message_encoding value this decoder handles (e.g. "protobuf").
decode ¶
Turns decoded_msg produced by iter_decoded_messages() of mcap.reader into a plain dictionary
after checking that the passed message encoding is supported by the decoder.
register_schema ¶
Registers schema's protobuf FileDescriptorSet into the pool so messages of this
type can be decoded during iteration, then computes the per-field postprocessors this
schema needs for PyArrow compliance. Skips schemas already registered in the pool.