qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Ross <tr...@redhat.com>
Subject Re: Proton-C Codec Question
Date Thu, 15 Dec 2016 16:59:51 GMT

On 12/15/2016 11:44 AM, Andrew Stitcher wrote:
> On Thu, 2016-12-15 at 08:54 -0500, Ted Ross wrote:
>> I have a map, held in a pn_data_t structure.  I want to replace the
>> value of one of the entries in the map with a new value.  Is there a
>> way
>> to do this in-place or do I need to create a new pn_data_t and copy
>> the
>> old into the new, replacing the value I want to replace?
>
> In principle, the current pn_data_t datastructure does allow you to do
> this by using pn_data_next until you find the element then
> pn_data_put_xx to replace. There is no path based navigation, although
> there seems to be (an unused) way to directly search symbols or
> strings.
>
> HOWEVER (big however!)
>
> Currently there is *no* code that actually modifies the middle of
> pn_data_t in place. Code only decodes AMQP data bytes then reads the
> data structure from the pn_data_t or creates the pn_data_t and writes
> the bytes. The pn_data_t code is complex and the structure is much
> larger and more complex (and hance almost certainly slower) than 2
> different structures one specialised for read and one for write would
> be.
>
> Given this it has been in mind for a while now to transition the use of
> pn_data_t to 2 new read and write only structures.

For the record, Dispatch has a similar facility.  There are two modules: 
Parse and Compose.  Parse is for reading encoded data and Compose is for 
writing encoded data.  In both cases, the data is stored in the encoded 
format in buffer chains.

Thank you, this is helpful.  I will follow your advice.

>
> So I'd really appreciate it if you just copy the pn_data_t changing the
>  element you need to change on the way! From what I can see of the API
> this is hardly less time efficient anyway, but may use more space due
> to needing a pn_data_t to copy into.
>
> HTH
>
> Andrew
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message