next: Deep-copy methods for Mesos messages?
wrouesnel opened this issue · 2 comments
The protocol buffer / message conversions on the next branch are a big improvement over the existing ones in leading to cleaner code, but there's still a fair amount of use of pointers within the structs.
This is somewhat unfriendly because it introduces ownership problems when passing Mesos messages via channels.
I'm not familiar with the protocol buffer code generators, since it would take some introspection to figure out if "null" types can be safely represented as 0-values, but a good middle-ground solution (of unknown complexity to me) would be to provide deep-copy (and deep-equals?) methods for all structs which implement pointers for nullable types, to allow for easy confidence that passed around structs are fully independent.
nullable fields aren't necessarily the same as go's zero values. the
protobuf lib does include a Clone func that you can use for deep-copy
ops, though it relies on reflection so don't expect much speed. we'd
happily accept a PR that introduces code generation for deep-copy w/o the
cost of reflection.
On Sun, May 8, 2016 at 12:24 PM, Will Rouesnel notifications@github.com
wrote:
The protocol buffer / message conversions on the next branch are a big
improvement over the existing ones in leading to cleaner code, but there's
still a fair amount of use of pointers within the structs.This is somewhat unfriendly because it introduces ownership problems when
passing Mesos messages via channels.I'm not familiar with the protocol buffer code generators, since it would
take some introspection to figure out if "null" types can be safely
represented as 0-values, but a good middle-ground solution (of unknown
complexity to me) would be to provide deep-copy (and deep-equals?) methods
for all structs which implement pointers for nullable types, to allow for
easy confidence that passed around structs are fully independent.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#244
closing this out since I think the question has been answered. feel free to re-open if necessary.