This based on https://github.com/lbryio/lbry-sdk/pull/3697, but moving away from protobuf.Any. This allows deleting some code to detect unknown extension types and the code to unpack a message from the Any.
I also discovered that there is a well-known type protobuf.Struct which is far more advanced than my StringMap but serves the same purpose. The backbone of protobuf.Struct is a map<string, Value> just like StringMap, but protobuf.Struct can represent any JSON object with numeric fields, bool fields, string fields, list of X fields, object fields, and more. Using this allowed even more simplification.
Coverage decreased (-0.6%) to 56.057% when pulling 4f1d82addd6510c036cf2b671f265c22a133f136 on moodyjon:stringmap_extensions into 6258651650f851190582be69c92cc476289c0bc8 on lbryio:master.
Context: https://github.com/lbryio/types/issues/49
This based on https://github.com/lbryio/lbry-sdk/pull/3697, but moving away from
protobuf.Any
. This allows deleting some code to detect unknown extension types and the code to unpack a message from theAny
.I also discovered that there is a well-known type
protobuf.Struct
which is far more advanced than myStringMap
but serves the same purpose. The backbone ofprotobuf.Struct
is amap<string, Value>
just likeStringMap
, butprotobuf.Struct
can represent any JSON object with numeric fields, bool fields, string fields, list of X fields, object fields, and more. Using this allowed even more simplification.Definition of
google.protobuf.Struct
: https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/struct.protoTo see the claim.proto changes go here: https://github.com/moodyjon/types/commits/repost_modify
Hub changes that would index the extension fields are here: https://github.com/lbryio/hub/pull/113