summaryrefslogtreecommitdiffabout
path: root/lib/App/Glacier/Command/Get.pm
Unidiff
Diffstat (limited to 'lib/App/Glacier/Command/Get.pm') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/App/Glacier/Command/Get.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/App/Glacier/Command/Get.pm b/lib/App/Glacier/Command/Get.pm
index 0d17659..82b32c8 100644
--- a/lib/App/Glacier/Command/Get.pm
+++ b/lib/App/Glacier/Command/Get.pm
@@ -160,6 +160,8 @@ sub run {
160 if ($job->is_completed) { 160 if ($job->is_completed) {
161 my $cache_file = $job->cache_file; 161 my $cache_file = $job->cache_file;
162 if (-f $cache_file) { 162 if (-f $cache_file) {
163 $self->debug(1, "$job: copying from $cache_file");
164 return if $self->dry_run;
163 unless (copy($cache_file, $localname)) { 165 unless (copy($cache_file, $localname)) {
164 $self->abend(EX_FAILURE, 166 $self->abend(EX_FAILURE,
165 "can't copy $cache_file to $localname: $!"); 167 "can't copy $cache_file to $localname: $!");
@@ -193,6 +195,7 @@ use constant TWOMB => 2*MB;
193 195
194sub download { 196sub download {
195 my ($self, $job, $localname) = @_; 197 my ($self, $job, $localname) = @_;
198
196 my $archive_size = $job->get('ArchiveSizeInBytes'); 199 my $archive_size = $job->get('ArchiveSizeInBytes');
197 if ($archive_size < $self->cf_transfer_param(qw(download single-part-size))) { 200 if ($archive_size < $self->cf_transfer_param(qw(download single-part-size))) {
198 # simple download 201 # simple download
@@ -214,9 +217,7 @@ sub _open_output {
214sub _download_simple { 217sub _download_simple {
215 my ($self, $job, $localname) = @_; 218 my ($self, $job, $localname) = @_;
216 219
217 eval { # FIXME: file_name might be absent 220 $self->debug(1, "$job: downloading in single part");
218 $self->debug(1, "downloading", $job->file_name(1), "in single part");
219 };
220 return if $self->dry_run; 221 return if $self->dry_run;
221 my $fd = $self->_open_output($localname); 222 my $fd = $self->_open_output($localname);
222 my ($res, $tree_hash) = $self->glacier->Get_job_output($job->vault, 223 my ($res, $tree_hash) = $self->glacier->Get_job_output($job->vault,
@@ -256,8 +257,8 @@ sub _download_multipart {
256 # Compute the number of parts per job 257 # Compute the number of parts per job
257 my $job_parts = int(($total_parts + $njobs - 1) / $njobs); 258 my $job_parts = int(($total_parts + $njobs - 1) / $njobs);
258 259
259 $self->debug(1, 260 $self->debug(1, "$job: downloading in chunks of $part_size bytes, in $njobs jobs, with $job_parts parts per job");
260 "downloading", $job->file_name(1), "to $localname in chunks of $part_size bytes, in $njobs jobs, with $job_parts parts per job"); 261
261 return if $self->dry_run; 262 return if $self->dry_run;
262 263
263 use Fcntl qw(SEEK_SET); 264 use Fcntl qw(SEEK_SET);

Return to:

Send suggestions and report system problems to the System administrator.