[openstack-dev] A proposal for RPC-friendly objects
Dan Smith
dms at danplanet.com
Tue May 7 23:01:34 UTC 2013
> 'args': {
> 'arg1': {
> 'oslo.object_name': 'nova.MyObject',
That looks good to me.
> jsonutils.dumps() will automatically call jsonutils.to_primitive() on
> anything that is not a primitive type. We could add a check in there
> to see if the object has a to_primitive() method and if so, call that.
Hmm, I'll have to look at this a bit. I had it hacked into RpcProxy,
since we have easy access to the args, each of which we can check for
object-ness and serialize as needed. I liked this because of the
symmetry of putting the deserialization in RpcDispatcher. Just to be
clear, you're suggesting keeping jsonutils.to_primitive() and making it
stop recursing at an object with to_primitive() and call that instead?
> On the deserialize side, there's no hook really. You could subclass
> RpcDispatcher, override the dispatch() method and do it there, and
> then let the base dispatch() do its thing after you do
> deserialization magic.
Yeah, that was the plan. Would it be better to add "serialize_args()"
and "deserialize_args()" to Proxy and Dispatcher so that it's all in
one place and very clear?
Thanks!
--Dan
More information about the OpenStack-dev
mailing list