-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
erlang_protobuffs compatibility option #63
Comments
Might be interesting. What does |
By the way, is there any differences with file names? For example the module file end with If there is a difference, then I think it is not very well handled by the |
I'll have to read up a bit on the |
from my understanding |
@lrascao, for strings, for encoding, gpb actually accepts both strings, io lists and binaries, since it calls Similarly, for (From that point of view, |
Answers to your questions -
Booleans are decoded to
Yep! I used these Here is one compatibility issue. https://github.com/basho/erlang_protobuffs/blob/master/src/protobuffs.erl#L152-L153 I noticed this because Riak has one message that has a https://github.com/basho/riak_pb/blob/features/lrb/use-gpb/src/riak_pb_codec.erl#L406-L412 I see that, in the spec, However, other messages use |
In the protobuf format (on the wire), a |
For the record, all of the items in the first post are now included in 3.24.0, but keeping this open for a while in case we come to think of anything related. |
Hi Tomas - I found these functions that
What do you think about doing the same in |
What do these functions do? |
Decodingriak_core_pb:decode_riakobject_pb(DecodedObject) That is the same as (using riak_core_pb:decode_msg(DecodedObject, riakobject_pb) Encodingriak_core_pb:encode_riakobject_pb(#riakobject_pb{bucket=Bucket, key=Key, val=Value}) Is this in riak_core_pb:encode_msg(#riakobject_pb{bucket=Bucket, key=Key, val=Value}) These are very much "syntactic sugar" functions that would exist in |
Ah, I see, so for every I fired up the However, the first clause calls an internal helper called
I do not want to write compatibility functions for this first clause, mostly because I find it odd---more below---and also because I think it would complicate the Similarly, for decoding, there's a |
Tomas, I agree that the |
There's an obvious collision for compatibility encode/decode functions per message, if the message happens to be named just (Pre-emptively reasoning: Why would one like to add an So the question this builds up to: do you think it would be much of a nuisance if the compatibility functions were named I'd like the name collision to get a resolution, or else drop the idea. (Not being able to generate code if a message happens to be named Another thought (brain-storming): reduce area of collision by only generate compatibility functions if an option is specified, it would still collide, but I could accept those cases. Cons: other compatibility functions should be also under this option, and maybe a little bit messier code-generating code. |
An |
Agree. I have something locally for this now |
Hi, the 3.24.4 (just pushed) contains the option I also added a check at generation-time to see if there's a message named |
Revisiting... Now that we have an option (a good thing, I think), maybe this option should also imply: {module_name_suffix, "_pb"} and
to make life easier for any transitioners? |
Hm, I'd like to have the |
For the (About maps vs records, I don't know if this is a hot potato or not, but here goes: One could have a special However, the |
My bad! I actually misunderstood what the |
Ah, ok, no problems, easy enough to confuse the two |
In just-pushed 3.25.0, I've updated the {module_name_suffix, "_pb"}
{msg_name_to_lower, true} With this, I'm closing this issue, should any of you come to think of some more compatibility thing, just either re-open this issue, or open a new. |
@tomas-abrahamsson thanks! I am checking in after being on vacation for the past few weeks. |
@tomas-abrahamsson |
@lukebakken hehe, you did much of it yourself! Thanks to you too! |
Hi Tomas,
I'd like to propose an option in
gpb
to enable compatibility witherlang_protobuffs
. There are a few subtle differences between the libraries and having an option to makegpb
compatible would be a great way for Basho to directerlang_protobuffs
(epb
) users to your library.Here are the areas I've found so far -
gpb
usesencode_msg
/decode_msg
andepb
usesencode
/decode
epb
allows using0
and1
to specify true and falseepb
will encode a list of integers as a set of unicode code points forbytes
fields in a proto messageDo you think this could be a useful option?
Thanks -
Luke
The text was updated successfully, but these errors were encountered: