Price of listing objects

27 views
Skip to first unread message

ykk

unread,
May 28, 2011, 2:59:44 AM5/28/11
to gs-dis...@googlegroups.com
Hi,

I understand that Google Storage provides some free queries.  I am interested in understanding how the queries is calculated when using gsutil.  This is because the bucket I am accessing has 1.5 million files!

When using sample code from 
uri = boto.storage_uri(DOGS_BUCKET, GOOGLE_STORAGE)
for obj in uri.get_bucket():
 
print '%s://%s/%s' % (uri.scheme, uri.bucket_name, obj.name)
 
print '  "%s"' % obj.get_contents_as_string()

If DOG_BUCKET has 100 items, does this code uses 101 queries, or just 1.  I understand gsutil ls gs://dog_bucket, uses one query.  How can I replicate that with the gsutil library?

Thanks in advance.

Regards
KK

Jerjou Cheng

unread,
May 31, 2011, 2:28:58 PM5/31/11
to gs-dis...@googlegroups.com
Hello-

You can test for yourself how the code behaves if you like - just pass in the 'debug' parameter (set it to something greater than 0), and it will print out more information about each request. eg:

uri = boto.storage_url(DOGS_BUCKET, GOOGLE_STORAGE, debug=2)

In this case, the uri.get_bucket() call should correspond to a normal GET request on a bucket, and should only use one request, where the response includes the 100 items.

-Jerjou

--
You received this message because you are subscribed to the Google Groups "Google Storage for Developers" group.
To post to this group, send email to gs-dis...@googlegroups.com.
To unsubscribe from this group, send email to gs-discussio...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gs-discussion?hl=en.



--
Developer Programs Engineer
Google Storage
Reply all
Reply to author
Forward
0 new messages