Archived

This forum has been archived. Please start a new discussion on GitHub.

Adding new members to struct that is passed over ICE?

I have a struct that is passed between our receiver and sender quite often and I would like to add two new data members to it.

I can't seem to find anything in the documentation on how this will effect backwards compatibility, so I'm wondering what exactly would happen if we connect a receiver using this new struct to a sender who still uses the old struct (or visa versa)?

Comments

  • mes
    mes California
    Hi Ashton,

    Welcome to the forum.

    Most changes to data members would break backward compatibility: adding a member, removing a member, and changing the type or declaration order of a member. The Ice encoding does not include type metadata therefore the receiver would have no way of knowing about these changes.

    We added support for optional values in Ice 3.5 to ease this versioning problem. However, even this wouldn't help in your case because structures do not support optional members.

    One possible workaround would be to add an entirely new operation that accepts a new type. Adding a new operation to an interface doesn't break backward compatibility, but it does mean that callers are able to handle the situation where this new operation is not supported by all targets.

    Regards,
    Mark
  • Hi Mes,

    Thanks for the quick response!

    Using a new operation which includes a new version of our struct (Struct2.0) was our first idea, so maybe we will explore more down that route.

    Thanks again,

    Ashton
    mes wrote: »
    Hi Ashton,

    Welcome to the forum.

    Most changes to data members would break backward compatibility: adding a member, removing a member, and changing the type or declaration order of a member. The Ice encoding does not include type metadata therefore the receiver would have no way of knowing about these changes.

    We added support for optional values in Ice 3.5 to ease this versioning problem. However, even this wouldn't help in your case because structures do not support optional members.

    One possible workaround would be to add an entirely new operation that accepts a new type. Adding a new operation to an interface doesn't break backward compatibility, but it does mean that callers are able to handle the situation where this new operation is not supported by all targets.

    Regards,
    Mark