lbryio / lbry-sdk

The LBRY SDK for building decentralized, censorship resistant, monetized, digital content apps.
https://lbry.com
MIT License
7.19k stars 482 forks source link

Reposts with deletions/edits V3 #3706

Open moodyjon opened 1 year ago

moodyjon commented 1 year ago

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 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.

Definition of google.protobuf.Struct: https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/struct.proto

To 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

coveralls commented 1 year ago

Coverage Status

Coverage decreased (-0.6%) to 56.057% when pulling 4f1d82addd6510c036cf2b671f265c22a133f136 on moodyjon:stringmap_extensions into 6258651650f851190582be69c92cc476289c0bc8 on lbryio:master.