blackbull.grpc.codec¶
blackbull.grpc.codec
¶
gRPC length-prefixed message framing.
The compressed flag travels here but compression belongs to the compression module. Protobuf serialization remains the handler's responsibility.
GrpcDecodeError
¶
Bases: ValueError
Invalid message framing: compression flag, length, or incomplete input.
decode_messages(data)
¶
Parse data into a list of (compressed, payload) messages.
A single DATA buffer may contain zero, one, or many framed messages
(gRPC permits multiple messages per stream and does not align them to
DATA-frame boundaries). Raises GrpcDecodeError on a truncated
prefix, an invalid compression flag, or a short message body.
encode_message(payload, *, compressed=False)
¶
Frame payload as a single gRPC Length-Prefixed-Message.