Re:Add extra stuff to a “standard” encoding? Sure, why not
by lifthrasiir on Wednesday September 20, 2023 @02:19AM
(#37580965)
You can also define a wrapper message with a single repeated field. The resulting encoding would be `varint(field id * 8 + 1) varint(length)` plus the actual message, so it can be also easily generated from and parsed back into a raw byte sequence without protoc.
[ Parent
| on HN ]
Re:Add extra stuff to a “standard” encoding? Sure, why not
by xyzzy_plugh on Wednesday September 20, 2023 @02:41PM
(#37588175)
This approach is problematic because, as far as I know, all implementations expect to deserialize from a complete buffer -- at least all official implementations. That means the entire "stream" would have to be buffered in memory.
You can, of course, simply read field by field, but few libraries expose the ability to do that simply. And the naive operation then becomes quite problematic indeed.