Return-Path: X-Original-To: apmail-zookeeper-user-archive@www.apache.org Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3073C116EC for ; Tue, 10 Jun 2014 07:43:55 +0000 (UTC) Received: (qmail 38548 invoked by uid 500); 10 Jun 2014 07:43:54 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 38493 invoked by uid 500); 10 Jun 2014 07:43:54 -0000 Mailing-List: contact user-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@zookeeper.apache.org Delivered-To: mailing list user@zookeeper.apache.org Received: (qmail 38482 invoked by uid 99); 10 Jun 2014 07:43:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jun 2014 07:43:54 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of samoilov@gmail.com designates 209.85.160.44 as permitted sender) Received: from [209.85.160.44] (HELO mail-pb0-f44.google.com) (209.85.160.44) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jun 2014 07:43:51 +0000 Received: by mail-pb0-f44.google.com with SMTP id rq2so5942970pbb.31 for ; Tue, 10 Jun 2014 00:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=slUeYAZ2dSd4fr3towBdNYy/ehE8AgEapOprzbd2i54=; b=b4W/wsTN2vzU+LggKdtbm0Vy+k1LrkVp+5NnQlmAAGVaOuYDjz44chNXNMF/cZdhDx +/ykZqnnCdFLi4oJuT3l02G/VnS+PKcL4KUc3QRTYn8BIcEQvZS5MJLGpLB7NDyiUVCl /KXyvnyN1dvfQmjDpZ6gfLSP33K4eHcWCWBMxbJVLSuiwIJYEx88iWUSgivZlW6ROY0T 7yr6O8uFgWPgqNF7snRWGkmhCOoGPghGRf5SV4aaXOQMV4MGMTq/ZItlHlw1VYL4fO5V QVR49sm4UbFOex1VufiHG3FTCAqTIy8KGCfvTWJKyL139yeTPq42OUGjmg9t2H43HQuH Eehw== MIME-Version: 1.0 X-Received: by 10.68.137.193 with SMTP id qk1mr8881902pbb.155.1402386207234; Tue, 10 Jun 2014 00:43:27 -0700 (PDT) Received: by 10.70.96.6 with HTTP; Tue, 10 Jun 2014 00:43:27 -0700 (PDT) In-Reply-To: References: Date: Tue, 10 Jun 2014 00:43:27 -0700 Message-ID: Subject: Re: zoo_get - how to get full item? From: Denis Samoilov To: user@zookeeper.apache.org, michi@cs.stanford.edu Content-Type: multipart/alternative; boundary=047d7b2e4a78b8614004fb767b5c X-Virus-Checked: Checked by ClamAV on apache.org --047d7b2e4a78b8614004fb767b5c Content-Type: text/plain; charset=UTF-8 Hi Michi, Thank you for the tip about test code! Unfortunately I miss something in you code example: how would it allow to detect is data under "/path" bigger than 1024? This is my main problem: the process that reads data does not know data size. I can read in a cycle multiplying buffer by 2 till buffer_length will be less than sent but maybe some better solution exists. Thank you, Denis On Mon, Jun 9, 2014 at 9:28 PM, Michi Mutsuzaki wrote: > 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 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 > --047d7b2e4a78b8614004fb767b5c--