zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michi Mutsuzaki <mi...@cs.stanford.edu>
Subject Re: zoo_get - how to get full item?
Date Tue, 10 Jun 2014 04:28:16 GMT
Hi Denis,

You can use the unit test code for reference, but something like this
should work (not tested).

int buffer_length = 1024;
char buffer[1024];
zoo_get (handle, "/path", 0, buffer, &buffer_length, NULL);

http://svn.apache.org/viewvc/zookeeper/trunk/src/c/tests/TestClient.cc?view=markup


On Mon, Jun 9, 2014 at 8:55 PM, Denis Samoilov <samoilov@gmail.com> wrote:
> hello,
>
> I am sorry for the very n00b question. But I read whole documentation, did
> search for the archives but still do not understand how to get full data
> from ZK using C binding zoo_get.
>
> I expect that
> *buffer_len* is the size of the buffer
> <http://zookeeper.sourcearchive.com/documentation/3.2.2plus-pdfsg3-2/structbuffer.html>
> pointed to by the buffer
> <http://zookeeper.sourcearchive.com/documentation/3.2.2plus-pdfsg3-2/structbuffer.html>
> parameter. It'll be set to the actual data length upon return. If the data
> is NULL, length is -1.
>
> will return me actual data size but it did not. So if I send buffer with
> size 1 for the data size 3 it returns me 1 in buffer_len :(  (i expect 3 to
> allocate new buffer of size 3)
>
> It seem I miss something simple but cannot figure out what.
>
> Thank you,
> Denis

Mime
View raw message