<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Amazon S3 CFC Update &#8211; Now With Listings!</title>
	<atom:link href="http://www.barneyb.com/barneyblog/2010/06/08/listings-for-amazon-s3-cfc/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.barneyb.com/barneyblog/2010/06/08/listings-for-amazon-s3-cfc/</link>
	<description>Thoughts, rants, and even some code from the mind of Barney Boisvert.</description>
	<lastBuildDate>Thu, 11 Sep 2014 09:58:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2010/06/08/listings-for-amazon-s3-cfc/comment-page-1/#comment-230315</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Thu, 09 Dec 2010 19:50:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1543#comment-230315</guid>
		<description>Gaurav,

1000 is a hard limit imposed by Amazon, not something I control.  Nor is it possible to specify a numeric offset - you have to specifically refer to the 1000th object when requesting objects 1001-2000.  Adding a &#039;marker&#039; parameter to the listObjects method would be straightforward: if present, just pass it through to S3 (ensuring it gets included in the signature string, of course).

That said, it&#039;d probably be more convenient to have the method expose &quot;normal&quot; offset/limit parameters, and then it&#039;d be in charge of figuring out how to query for them with &#039;marker&#039;, so that logic doesn&#039;t have to be in the application.  However, this could potentially be expensive, as every invocation would have to start at the top and scroll down until it found the desired records.  I.e., listObjects(..., limit: 50, offset: 1400) would require quering for the first 1000, throwing them away, and then querying for 1001-2000.  In most cases it probably doesn&#039;t matter, but it&#039;s something to consider if the CFC were to adapt the semantics.</description>
		<content:encoded><![CDATA[<p>Gaurav,</p>
<p>1000 is a hard limit imposed by Amazon, not something I control.  Nor is it possible to specify a numeric offset &#8211; you have to specifically refer to the 1000th object when requesting objects 1001-2000.  Adding a 'marker' parameter to the listObjects method would be straightforward: if present, just pass it through to S3 (ensuring it gets included in the signature string, of course).</p>
<p>That said, it'd probably be more convenient to have the method expose "normal" offset/limit parameters, and then it'd be in charge of figuring out how to query for them with 'marker', so that logic doesn't have to be in the application.  However, this could potentially be expensive, as every invocation would have to start at the top and scroll down until it found the desired records.  I.e., listObjects(&#8230;, limit: 50, offset: 1400) would require quering for the first 1000, throwing them away, and then querying for 1001-2000.  In most cases it probably doesn't matter, but it's something to consider if the CFC were to adapt the semantics.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gaurav Malik</title>
		<link>https://www.barneyb.com/barneyblog/2010/06/08/listings-for-amazon-s3-cfc/comment-page-1/#comment-230313</link>
		<dc:creator>Gaurav Malik</dc:creator>
		<pubDate>Thu, 09 Dec 2010 19:42:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1543#comment-230313</guid>
		<description>Hi Barney,

Thanks for that.  So how do you suggest to scroll via the ListObjects methods?  If I know that listObjects method gets the 1000th item, can I then ask for the next 1000th item or do I have to explictlly refer to the 1000th Object and then start from there.  Sorry for the details. 

Is there any way the 1000 records can be made into a argument, so when using the method you can choose how many records to bring back.</description>
		<content:encoded><![CDATA[<p>Hi Barney,</p>
<p>Thanks for that.  So how do you suggest to scroll via the ListObjects methods?  If I know that listObjects method gets the 1000th item, can I then ask for the next 1000th item or do I have to explictlly refer to the 1000th Object and then start from there.  Sorry for the details. </p>
<p>Is there any way the 1000 records can be made into a argument, so when using the method you can choose how many records to bring back.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2010/06/08/listings-for-amazon-s3-cfc/comment-page-1/#comment-229582</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Mon, 06 Dec 2010 16:37:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1543#comment-229582</guid>
		<description>Gaurav,

Yes, the 1000-row limit is expected.  The S3 service returns a maximum of 1000 record per LIST request.  If you want another &quot;page&quot; of records, you have to rerequest the listing and add the &#039;marker&#039; parameter, which is an objectKey to start after.

I intentionally didn&#039;t make the &#039;listObjects&#039; method automatically go through and build a complete list of every object within a bucket.  It just returns the first page.  However, I also haven&#039;t implemented a way to supply &#039;marker&#039; to the method if you need a subsequent &quot;page&quot; of record.  You can, however use the &#039;prefix&#039; argument to request a specific objectKey, if you want the metadata about an object.</description>
		<content:encoded><![CDATA[<p>Gaurav,</p>
<p>Yes, the 1000-row limit is expected.  The S3 service returns a maximum of 1000 record per LIST request.  If you want another "page" of records, you have to rerequest the listing and add the 'marker' parameter, which is an objectKey to start after.</p>
<p>I intentionally didn't make the 'listObjects' method automatically go through and build a complete list of every object within a bucket.  It just returns the first page.  However, I also haven't implemented a way to supply 'marker' to the method if you need a subsequent "page" of record.  You can, however use the 'prefix' argument to request a specific objectKey, if you want the metadata about an object.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gaurav Malik</title>
		<link>https://www.barneyb.com/barneyblog/2010/06/08/listings-for-amazon-s3-cfc/comment-page-1/#comment-229323</link>
		<dc:creator>Gaurav Malik</dc:creator>
		<pubDate>Sun, 05 Dec 2010 19:12:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1543#comment-229323</guid>
		<description>Hi Barney,

Thanks for the cfc it is really excellent am still playing with it.  One thing I noticed is that the list object only returns a 1000 items.  Is that normal?  I am using CFMX Ver 7.

Many thanks,

Gaurav</description>
		<content:encoded><![CDATA[<p>Hi Barney,</p>
<p>Thanks for the cfc it is really excellent am still playing with it.  One thing I noticed is that the list object only returns a 1000 items.  Is that normal?  I am using CFMX Ver 7.</p>
<p>Many thanks,</p>
<p>Gaurav</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jules Gravinese</title>
		<link>https://www.barneyb.com/barneyblog/2010/06/08/listings-for-amazon-s3-cfc/comment-page-1/#comment-218891</link>
		<dc:creator>Jules Gravinese</dc:creator>
		<pubDate>Thu, 02 Sep 2010 02:21:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1543#comment-218891</guid>
		<description>That stinks. AS3 should have a wildcard function instead. DELETE #psuedoDir#/* would be nice. Anyway... here&#039;s my contribution, in case anyone needs to do the same.

&lt;cffunction name=&quot;deleteS3File&quot; access=&quot;public&quot; output=&quot;false&quot; returntype=&quot;void&quot;&gt;
	&lt;cfargument name=&quot;bucket&quot; type=&quot;string&quot; required=&quot;true&quot; /&gt;
	&lt;cfargument name=&quot;objectKey&quot; type=&quot;string&quot; required=&quot;true&quot; /&gt;
	
	&lt;cfset q = application.as3.listObjects(bucket, &#039;&#039;, &#039;?&#039;) /&gt;
	&lt;cfloop query=&quot;q&quot;&gt;
		&lt;cfif listGetAt(q.name, 1, &quot;/&quot;) eq objectKey&gt;
			&lt;cfset deleteS3FileInternal(bucket, name, 0) /&gt;
		&lt;/cfif&gt;
	&lt;/cfloop&gt;
&lt;/cffunction&gt;</description>
		<content:encoded><![CDATA[<p>That stinks. AS3 should have a wildcard function instead. DELETE #psuedoDir#/* would be nice. Anyway&#8230; here's my contribution, in case anyone needs to do the same.</p>
<p>&lt;cffunction name="deleteS3File" access="public" output="false" returntype="void"&gt;<br />
	&lt;cfargument name="bucket" type="string" required="true" /&gt;<br />
	&lt;cfargument name="objectKey" type="string" required="true" /&gt;</p>
<p>	&lt;cfset q = application.as3.listObjects(bucket, ", '?') /&gt;<br />
	&lt;cfloop query="q"&gt;<br />
		&lt;cfif listGetAt(q.name, 1, "/") eq objectKey&gt;<br />
			&lt;cfset deleteS3FileInternal(bucket, name, 0) /&gt;<br />
		&lt;/cfif&gt;<br />
	&lt;/cfloop&gt;<br />
&lt;/cffunction&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2010/06/08/listings-for-amazon-s3-cfc/comment-page-1/#comment-218888</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Thu, 02 Sep 2010 01:57:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1543#comment-218888</guid>
		<description>Jules, you are correct.  You must delete each individual object with a separate DELETE request.   So yes, the answer to your question is exactly what you propose, do a LIST request with a prefix of your &quot;folder&quot; name plus a trailing slash, and then delete every object that comes back (and make sure you consider paging if you have more than 1000 objects with the prefix).</description>
		<content:encoded><![CDATA[<p>Jules, you are correct.  You must delete each individual object with a separate DELETE request.   So yes, the answer to your question is exactly what you propose, do a LIST request with a prefix of your "folder" name plus a trailing slash, and then delete every object that comes back (and make sure you consider paging if you have more than 1000 objects with the prefix).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jules Gravinese</title>
		<link>https://www.barneyb.com/barneyblog/2010/06/08/listings-for-amazon-s3-cfc/comment-page-1/#comment-218887</link>
		<dc:creator>Jules Gravinese</dc:creator>
		<pubDate>Thu, 02 Sep 2010 01:49:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1543#comment-218887</guid>
		<description>Yes I realize that. That&#039;s why I put quotes around &quot;folder&quot; and called it &quot;psuedoDir&quot;. What is the workaround then?

My first thought is to edit your deleteS3File function. First get the list of objects in the bucket. Loop through them looking for a match of listGetAt(name,1,&#039;/&#039;) EQ pseudoDir. With each match call deleteS3FileInternal(bucket, name, 0).

Seem resource intensive though. I was just hoping there was a smarter way to do it that I overlooked.</description>
		<content:encoded><![CDATA[<p>Yes I realize that. That's why I put quotes around "folder" and called it "psuedoDir". What is the workaround then?</p>
<p>My first thought is to edit your deleteS3File function. First get the list of objects in the bucket. Loop through them looking for a match of listGetAt(name,1,'/') EQ pseudoDir. With each match call deleteS3FileInternal(bucket, name, 0).</p>
<p>Seem resource intensive though. I was just hoping there was a smarter way to do it that I overlooked.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2010/06/08/listings-for-amazon-s3-cfc/comment-page-1/#comment-218885</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Thu, 02 Sep 2010 01:36:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1543#comment-218885</guid>
		<description>Jules,

You can&#039;t; S3 doesn&#039;t have any concept of containment.  Every object is a top-level object which may or may not share a common prefix containing slashes with other objects, so you delete a &quot;folder&quot; by individually deleting each object with that &quot;folder&quot; as a prefix in it&#039;s object key.

Most S3 managers will use slashes as a delimiter to emulate browsing folders within your S3 bucket, but it&#039;s a UI construct, not something that S3 is actually aware of.

Hope that helps.</description>
		<content:encoded><![CDATA[<p>Jules,</p>
<p>You can't; S3 doesn't have any concept of containment.  Every object is a top-level object which may or may not share a common prefix containing slashes with other objects, so you delete a "folder" by individually deleting each object with that "folder" as a prefix in it's object key.</p>
<p>Most S3 managers will use slashes as a delimiter to emulate browsing folders within your S3 bucket, but it's a UI construct, not something that S3 is actually aware of.</p>
<p>Hope that helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jules Gravinese</title>
		<link>https://www.barneyb.com/barneyblog/2010/06/08/listings-for-amazon-s3-cfc/comment-page-1/#comment-218884</link>
		<dc:creator>Jules Gravinese</dc:creator>
		<pubDate>Thu, 02 Sep 2010 01:04:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1543#comment-218884</guid>
		<description>How do you delete a &#039;folder&#039;?  does not seem to do anything if there are objects within that folder.</description>
		<content:encoded><![CDATA[<p>How do you delete a 'folder'?  does not seem to do anything if there are objects within that folder.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>https://www.barneyb.com/barneyblog/2010/06/08/listings-for-amazon-s3-cfc/comment-page-1/#comment-213951</link>
		<dc:creator>David</dc:creator>
		<pubDate>Wed, 16 Jun 2010 21:38:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1543#comment-213951</guid>
		<description>Awesome, really! You responded immediately and are very supportive with your suggestions. Thanks! I will send you a revised file.</description>
		<content:encoded><![CDATA[<p>Awesome, really! You responded immediately and are very supportive with your suggestions. Thanks! I will send you a revised file.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
