You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Nikola Knezevic <la...@gmail.com> on 2014/07/03 19:18:56 UTC

Is it possible to abort putBlob operation?

Hi all,

is there a way to abort a putBlob operation, making sure that the object
store will not create the blob?

For example, if I'm issue a putBlob operation, where I generate the content
and pass it to the Blob through PipedInputStream/PipedOutputStream pair,
would it be possible to abort the operation if there is an exception in the
generation. I'm not sure would mere closing of a blob's stream prevent the
object store from creating the blob. If the input stream I pass to
blob.setPayload() throws an IOException, would that do the trick?

Thanks,
Nikola

Re: Is it possible to abort putBlob operation?

Posted by Andrew Phillips <an...@apache.org>.
> However, the more likely case would be the first one, to abort after  
> jclouds has made the HTTP call.

I'm not the expert in this area, but in that case I would assume the  
result may well depend on how the target provider handles the case  
that the client does not send the full payload.

Hopefully one of the blobstore experts will be able to provide some  
more details!

ap

Re: Is it possible to abort putBlob operation?

Posted by Nikola Knežević <la...@gmail.com>.
On 03 Jul 2014, at 19:27 , Andrew Phillips <an...@apache.org> wrote:

> Hi Nikola
> 
>> is there a way to abort a putBlob operation, making sure that the object
>> store will not create the blob?
> 
> Just to clarify: are you looking to issue the abort *after* jclouds has made the HTTP call (i.e. while it's busy transmitting the content to the target), or after you've invoked the "putBlob" method but *before* the HTTP request starts? Or some other scenario?

Hi Andrew,

well, both, actually :) Since as an user of the library, I don’t know whether jclouds has made the HTTP call. However, the more likely case would be the first one, to abort after jclouds has made the HTTP call.

Thanks,
Nikola



Re: Is it possible to abort putBlob operation?

Posted by Andrew Phillips <an...@apache.org>.
Hi Nikola

> is there a way to abort a putBlob operation, making sure that the object
> store will not create the blob?

Just to clarify: are you looking to issue the abort *after* jclouds  
has made the HTTP call (i.e. while it's busy transmitting the content  
to the target), or after you've invoked the "putBlob" method but  
*before* the HTTP request starts? Or some other scenario?

Regards

ap

Re: Is it possible to abort putBlob operation?

Posted by Andrew Gaul <ga...@apache.org>.
On Thu, Jul 03, 2014 at 07:18:56PM +0200, Nikola Knezevic wrote:
> is there a way to abort a putBlob operation, making sure that the object
> store will not create the blob?

jclouds does not support aborting putBlob, but you appear to have found
a clever workaround below!  jclouds 1.7.3 also does not support aborting
getBlob but we are tracking this issue and a fix at:

https://issues.apache.org/jira/browse/JCLOUDS-417
https://github.com/jclouds/jclouds/pull/435

> For example, if I'm issue a putBlob operation, where I generate the content
> and pass it to the Blob through PipedInputStream/PipedOutputStream pair,
> would it be possible to abort the operation if there is an exception in the
> generation. I'm not sure would mere closing of a blob's stream prevent the
> object store from creating the blob. If the input stream I pass to
> blob.setPayload() throws an IOException, would that do the trick?

This will work although you should provide the blobstore some cookie to
know that the blob did not complete successfully, e.g., Content-length
or Content-MD5.  Further you should ensure that you use a non-repeatable
Payload like an InputStream, specifically a PipedInputStream will work.

jclouds should provide real support for aborting putBlob.  Can you open
a JIRA issue to track this?  It intersects with some of our
AsyncBlobStore discussion.

-- 
Andrew Gaul
http://gaul.org/