zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kah-Chan Low <kahchan...@yahoo.com>
Subject Re: C binding zoo_get(): need to know max data length in advance
Date Fri, 10 Jan 2014 19:30:58 GMT
Thanks for the suggestion Marshall!

zoo_get() returns ZOK all the same except that the data is silently truncated to fit the buffer
size.
However, what I can do is to compare the buffer size to Stat.dataLength returned along with
zoo_get().





On Friday, January 10, 2014 12:13 PM, Marshall McMullen <marshall.mcmullen@gmail.com>
wrote:
 
I think this is a pretty common use-case actually. If one client has put something into zookeeper
and another client is trying to pull it out it may not know it advance how big the data client#1
put in. What we do locally is have a wrapper around zoo_get that starts with a reasonable
default for buffer_len. If it fails b/c the data is larger than that, then you can inspect
the size inside the returned Stat* and then re-issue the get with the correct value. 



On Fri, Jan 10, 2014 at 10:02 AM, Raúl Gutiérrez Segalés <rgs@itevenworks.net> wrote:

On 10 January 2014 08:04, Kah-Chan Low <kahchanlow@yahoo.com> wrote:
>
>> int zoo_get(zhandle_t *zh, const char *path, int watch, char *buffer,
>>         int* buffer_len, struct Stat *stat)
>>
>> Developer has to anticipate the max. size of the node data.  Is there any
>> way to get around this?
>>
>
>In which case would you not know the size?
>
>-rgs
>
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message