<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 3, 2016 at 1:04 PM, Amrith Kumar <span dir="ltr"><<a href="mailto:amrith@tesora.com" target="_blank">amrith@tesora.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Gordon,<br>
<br>
You can see a very quick-and-dirty prototype of the kind of thing I'm<br>
looking to do in Trove at<br>
<a href="https://gist.github.com/amrith/6a89ff478f81c2910e84325923eddebe" rel="noreferrer" target="_blank">https://gist.github.com/<wbr>amrith/<wbr>6a89ff478f81c2910e84325923edde<wbr>be</a><br>
<br>
Uncommenting line 51 would simulate a bad hash.<br>
<br>
I'd be happy to propose something similar in oslo.messaging if you think<br>
that would pass muster there.<br>
<span class="gmail-im gmail-HOEnZb"><br>
-amrith<br>
<br>
-----Original Message-----<br>
From: gordon chung [mailto:<a href="mailto:gord@live.ca">gord@live.ca</a>]<br>
</span><span class="gmail-im gmail-HOEnZb">Sent: Thursday, November 3, 2016 3:09 PM<br>
To: <a href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.<wbr>org</a><br>
Subject: Re: [openstack-dev] [all][dev][python] constructing a deterministic<br>
representation of a python data structure<br>
<br>
<br>
<br>
</span><div class="gmail-HOEnZb"><div class="gmail-h5">On 03/11/16 02:24 PM, Amrith Kumar wrote:<br>
<br>
><br>
> So, just before calling call() or cast(), I could compute the hash and<br>
> stuff it into the dictionary that is being sent over, and I can do the<br>
> same on the receiving side. But since I cannot guarantee that the<br>
> representation on the receiving side is necessarily identical to the<br>
> representation on the sending side, I have issues computing the hash.<br>
><br>
><br>
<br>
based on description, you're trying to sign the messages? there was some<br>
effort done in oslo.messaging[1]<br>
<br>
we do something similar in Ceilometer to sign IPC messages[2]. it does add<br>
overhead though.<br>
<br>
[1] <a href="https://review.openstack.org/#/c/205330/" rel="noreferrer" target="_blank">https://review.openstack.org/#<wbr>/c/205330/</a><br>
[2]<br>
<a href="https://github.com/openstack/ceilometer/blob/ffc9ee99c10ede988769907fdb0594a
512c890cd/ceilometer/publisher/utils.py#L43-L58" rel="noreferrer" target="_blank">https://github.com/openstack/<wbr>ceilometer/blob/<wbr>ffc9ee99c10ede988769907fdb0594<wbr>a<br>
512c890cd/ceilometer/<wbr>publisher/utils.py#L43-L58</a><br>
<br>
cheers,<br>
--<br>
gord<br>
<br>
______________________________<wbr>______________________________<wbr>______________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.<wbr>openstack.org?subject:<wbr>unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack-dev</a><br>
</div></div><br>______________________________<wbr>______________________________<wbr>______________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.<wbr>openstack.org?subject:<wbr>unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack-dev</a><br>
<br></blockquote></div><br></div><div class="gmail_extra">I had to solve a similar issue for deterministic key generation in dogpile (key for memcache/etc) when memoizing methods/functions with kwargs. There are a couple issues you run into, default args are not represented in **kwargs, and non-positional args can come in any order. </div><div class="gmail_extra"><br></div><div class="gmail_extra">If you want an example of what we did to generate the cache-key programatically you can look here:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><a href="https://bitbucket.org/zzzeek/dogpile.cache/src/669582c2e5bf12b1303f50c4b7ba3dad308eb1cc/dogpile/cache/util.py?at=master&fileviewer=file-view-default#util.py-67:118">https://bitbucket.org/zzzeek/dogpile.cache/src/669582c2e5bf12b1303f50c4b7ba3dad308eb1cc/dogpile/cache/util.py?at=master&fileviewer=file-view-default#util.py-67:118</a><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">You don't need all the namespace and probably not fn/module info, but this can look at the call and handle / ensure defaults also match (or be used to extract default kwargs if needed) for passing down to RPC.</div><div class="gmail_extra"><br></div><div class="gmail_extra">--Morgan</div></div>