You are viewing a plain text version of this content. The canonical link for it is here.
Posted to proton@qpid.apache.org by Frank Quinn <fq...@nyx.com> on 2013/07/18 12:31:11 UTC

Using PN_MAP Data Types

Hi Folks,

I spotted your PN_MAP data type and I'm not sure what to do with it. I couldn't see anything which made PN_MAP behave any differently than any other container. I couldn't see any behaviour that implied lookup by key, and I couldn't find anything which handled inserting pairs or hashing.

At the current moment in time, is PN_MAP anything other than a container which you're hoping the application developer will insert an even number of elements into, or are there some other methods for lookup and iteration beyond simply stepping over its contents as you would a list or array? I see in some examples that people are using the symbol data type - is that recommended as a "key" or was that just one example way of using it?

Cheers,
Frank

________________________________

Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
------------------------------------------------------------------------------

Please consider the environment before printing this email.

Visit our website at http://www.nyse.com <http://www.nyse.com>
*****************************************************************************
Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.

Re: Using PN_MAP Data Types

Posted by Rafael Schloming <rh...@alum.mit.edu>.
The pn_data_lookup function provides some convenience for working with
PN_MAPs, but as you say it is really just an associate list, i.e. an
alternating sequence of key/value pairs. Technically you can use any value
as a key, but the protocol restricts certain maps to be symbol or string
keyed depending on where they are used, but in your own usage you can do
what you want.

One thing to understand here is that the data interface is intended for
efficient processing/manipulation of data off the wire (which is obviously
inherently serialized). It is really more designed to make it easy for you
to serialize/deserialize between AMQP map data in wire format and your own
map data structure rather than being a complete hash map implementation in
and of itself.

Proton does have an internal map and list datatype (pn_map_t/pn_list_t)
that it uses internally and we may well want to make this public as a way
to provide a more convenient way to access and manipulate AMQP containers,
however as a design principal I would think we'd want to also allow it to
be as easy as possible to use the data interface to go directly to a third
party hash map implementation, e.g. pn_map_t and pn_list_t shouldn't have
to use any special internal interface of pn_data_t.

--Rafael



On Thu, Jul 18, 2013 at 6:31 AM, Frank Quinn <fq...@nyx.com> wrote:

> Hi Folks,
>
> I spotted your PN_MAP data type and I'm not sure what to do with it. I
> couldn't see anything which made PN_MAP behave any differently than any
> other container. I couldn't see any behaviour that implied lookup by key,
> and I couldn't find anything which handled inserting pairs or hashing.
>
> At the current moment in time, is PN_MAP anything other than a container
> which you're hoping the application developer will insert an even number of
> elements into, or are there some other methods for lookup and iteration
> beyond simply stepping over its contents as you would a list or array? I
> see in some examples that people are using the symbol data type - is that
> recommended as a "key" or was that just one example way of using it?
>
> Cheers,
> Frank
>
> ________________________________
>
> Please consider the environment before printing this e-mail.
>
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient or have received this e-mail in error,
> please advise the sender immediately by reply e-mail and delete this
> message and any attachments without retaining a copy.
>
> Any unauthorised copying, disclosure or distribution of the material in
> this e-mail is strictly forbidden.
>
> ------------------------------------------------------------------------------
>
> Please consider the environment before printing this email.
>
> Visit our website at http://www.nyse.com <http://www.nyse.com>
>
> *****************************************************************************
> Note: The information contained in this message and any attachment to it
> is privileged, confidential and protected from disclosure. If the reader of
> this message is not the intended recipient, or an employee or agent
> responsible for delivering this message to the intended recipient, you are
> hereby notified that any dissemination, distribution or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please notify the sender immediately by replying to
> the message, and please delete it from your system. Thank you. NYSE
> Euronext.
>