Since Atmos objects are mutable, the easiest way to resume uploads is to get the current object size using getSystemMetadata() and then start appending (update) from that location onward.
You could automate this by enhancing the UploadHelper to detect failures in appendChunks() and retry the operation.
This does not sound correct to me. Setting the Metadata for "offset" should not do anything. The current implementation of UploadHelper.updateObject will truncate and replace the existing object.
You need to overload the updateObject method in UploadHelper to take an extra "offset" parameter. Then set currentBytes to this value and go directly to appendChunks().
JasonCwik
281 Posts
1
June 11th, 2012 07:00
Since Atmos objects are mutable, the easiest way to resume uploads is to get the current object size using getSystemMetadata() and then start appending (update) from that location onward.
You could automate this by enhancing the UploadHelper to detect failures in appendChunks() and retry the operation.
Avetik
1 Rookie
•
4 Posts
0
June 12th, 2012 01:00
I got size of the object in the server then updated it using followong code:
fis.skip(file.getContinuePos());// fis - FileOutputStream
MetadataList ml = new MetadataList();
ml.addMetadata(new Metadata("offset", String.valueOf(file.getContinuePos()), true));
uh.updateObject(id, fis, null, ml, null, true);
after updating there was last part of the file in the server.
Thanks a lot.
JasonCwik
281 Posts
1
June 12th, 2012 07:00
This does not sound correct to me. Setting the Metadata for "offset" should not do anything. The current implementation of UploadHelper.updateObject will truncate and replace the existing object.
You need to overload the updateObject method in UploadHelper to take an extra "offset" parameter. Then set currentBytes to this value and go directly to appendChunks().