Changeset 17637
- Timestamp:
- May 12, 2008, 12:04:53 PM (18 years ago)
- Location:
- trunk/DataStore
- Files:
-
- 9 edited
-
Changes (modified) (1 diff)
-
lib/DataStore/FileSet.pm (modified) (3 diffs)
-
lib/DataStore/Product.pm (modified) (3 diffs)
-
lib/DataStore/Root.pm (modified) (3 diffs)
-
scripts/dsfilesetls (modified) (6 diffs)
-
scripts/dsget (modified) (3 diffs)
-
scripts/dsleech (modified) (10 diffs)
-
scripts/dsproductls (modified) (7 diffs)
-
scripts/dsrootls (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataStore/Changes
r17552 r17637 2 2 3 3 0.07 4 - add --timeout option to all ds*ls utilties and other minor doc changes 5 - add the ability to all DataStore::* classes that handle HTTP to pass 6 options directly to LWP::UserAgent 4 7 - add support for checksumming compressed fits files 5 8 - Change DateStore::File to handle passing args to LWP::UserAgent 6 - add dsget --timeout option7 9 - change dsget to return the HTTP status code on failure 8 10 - remove use of parse_neb_key() from dsget -
trunk/DataStore/lib/DataStore/FileSet.pm
r15022 r17637 1 # Copyright (C) 2006 Joshua Hoblitt1 # Copyright (C) 2006-2008 Joshua Hoblitt 2 2 # 3 # $Id: FileSet.pm,v 1.1 4 2007-09-25 23:52:46jhoblitt Exp $3 # $Id: FileSet.pm,v 1.15 2008-05-12 22:04:53 jhoblitt Exp $ 4 4 5 5 package DataStore::FileSet; … … 9 9 10 10 use vars qw($VERSION); 11 $VERSION = '0.0 3';11 $VERSION = '0.04'; 12 12 13 13 use base qw( DataStore::Record ); … … 186 186 my $self = shift; 187 187 188 # no params 189 validate(@_, {}); 188 my %p = validate(@_, 189 { 190 ua_args => { 191 optional => 1, 192 }, 193 }, 194 ); 190 195 191 196 # make request 192 my $ua = LWP::UserAgent->new; 197 my $ua; 198 if (defined $p{ua_args}) { 199 $ua = LWP::UserAgent->new(%{$p{ua_args}}); 200 } else { 201 $ua = LWP::UserAgent->new; 202 } 193 203 my $request = HTTP::Request->new(GET => $self->uri); 194 204 my $response = $ua->request($request); -
trunk/DataStore/lib/DataStore/Product.pm
r15021 r17637 1 # Copyright (C) 2006 Joshua Hoblitt1 # Copyright (C) 2006-2008 Joshua Hoblitt 2 2 # 3 # $Id: Product.pm,v 1.1 0 2007-09-25 23:50:34jhoblitt Exp $3 # $Id: Product.pm,v 1.11 2008-05-12 22:04:53 jhoblitt Exp $ 4 4 5 5 package DataStore::Product; … … 9 9 10 10 use vars qw($VERSION); 11 $VERSION = '0.0 1';11 $VERSION = '0.02'; 12 12 13 13 use base qw( DataStore::Record ); … … 167 167 my $self = shift; 168 168 169 # no params 170 validate(@_, {}); 169 my %p = validate(@_, 170 { 171 ua_args => { 172 optional => 1, 173 }, 174 }, 175 ); 171 176 172 177 # make request 173 my $ua = LWP::UserAgent->new; 178 my $ua; 179 if (defined $p{ua_args}) { 180 $ua = LWP::UserAgent->new(%{$p{ua_args}}); 181 } else { 182 $ua = LWP::UserAgent->new; 183 } 184 174 185 my $request; 175 186 if ($self->last_fileset) { -
trunk/DataStore/lib/DataStore/Root.pm
r15025 r17637 1 1 # Adapted from Product.pm 2 2 # 3 # Copyright (C) 2006 Joshua Hoblitt3 # Copyright (C) 2006-2008 Joshua Hoblitt 4 4 # 5 # $Id: Root.pm,v 1. 4 2007-09-26 00:13:29jhoblitt Exp $5 # $Id: Root.pm,v 1.5 2008-05-12 22:04:53 jhoblitt Exp $ 6 6 7 7 package DataStore::Root; … … 11 11 12 12 use vars qw($VERSION); 13 $VERSION = '0.0 1';13 $VERSION = '0.02'; 14 14 15 15 use base qw( DataStore::Record ); … … 131 131 my $self = shift; 132 132 133 # no params 134 validate(@_, {}); 133 my %p = validate(@_, 134 { 135 ua_args => { 136 optional => 1, 137 }, 138 }, 139 ); 135 140 136 141 # make request 137 my $ua = LWP::UserAgent->new; 142 my $ua; 143 if (defined $p{ua_args}) { 144 $ua = LWP::UserAgent->new(%{$p{ua_args}}); 145 } else { 146 $ua = LWP::UserAgent->new; 147 } 148 138 149 my $request = HTTP::Request->new(GET => $self->uri); 139 150 my $response = $ua->request($request); -
trunk/DataStore/scripts/dsfilesetls
r17455 r17637 1 1 #!/usr/bin/env perl 2 2 3 # Copyright (C) 2006 Joshua Hoblitt3 # Copyright (C) 2006-2008 Joshua Hoblitt 4 4 # 5 # $Id: dsfilesetls,v 1. 6 2008-04-18 23:33:13 jhoblitt Exp $5 # $Id: dsfilesetls,v 1.7 2008-05-12 22:04:53 jhoblitt Exp $ 6 6 7 7 use strict; … … 16 16 use Pod::Usage qw( pod2usage ); 17 17 18 my ($uri );18 my ($uri, $timeout); 19 19 20 20 GetOptions( 21 21 'uri|u=s' => \$uri, 22 'timeout|t' => \$timeout, 22 23 ) or pod2usage( 2 ); 23 24 … … 28 29 ) unless defined $uri; 29 30 30 my $response = DataStore::FileSet->new( uri => $uri )->request; 31 # default http request timeout is 30s 32 $timeout ||= 30; 33 34 my $response = DataStore::FileSet->new( uri => $uri )->request( 35 ua_args => { timeout => $timeout }, 36 ); 31 37 32 38 die "request failed" unless defined $response; … … 76 82 The URI of the file to be retrieved. 77 83 84 =item * --timeout|-t 85 86 The ammount of time (in seconds) to wait for a response from the DataStore 87 after making an HTTP request. The default is 30s. 88 89 Optional. 90 78 91 =back 79 92 … … 92 105 =head1 COPYRIGHT 93 106 94 Copyright (C) 2006 Joshua Hoblitt. All rights reserved.107 Copyright (C) 2006-2008 Joshua Hoblitt. All rights reserved. 95 108 96 109 This program is free software; you can redistribute it and/or modify it under … … 112 125 =head1 SEE ALSO 113 126 114 L< DataStore>, L<DataStore::FileSet>, L<DataStore::File>127 L<dsget>, L<dsleech>, L<dsrootls>, L<dsproductls>, L<dsfilesetls>, L<DataStore> 115 128 116 129 =cut -
trunk/DataStore/scripts/dsget
r17552 r17637 3 3 # Copyright (C) 2006-2008 Joshua Hoblitt 4 4 # 5 # $Id: dsget,v 1.2 3 2008-05-07 03:05:03 jhoblitt Exp $5 # $Id: dsget,v 1.24 2008-05-12 22:04:53 jhoblitt Exp $ 6 6 7 7 use strict; … … 126 126 # request the file from the remote data store server (save in tmpfilename) 127 127 my $response = DataStore::File->new(%p)->request( 128 filename => $tmpfilename,129 ua_args => { timeout => $timeout},130 );128 filename => $tmpfilename, 129 ua_args => { timeout => $timeout }, 130 ); 131 131 132 132 die "request failed" unless defined $response; … … 282 282 =head1 SEE ALSO 283 283 284 L< DataStore>, L<DataStore::File>284 L<dsget>, L<dsleech>, L<dsrootls>, L<dsproductls>, L<dsfilesetls>, L<DataStore> 285 285 286 286 =cut -
trunk/DataStore/scripts/dsleech
r16582 r17637 1 1 #!/usr/bin/env perl 2 2 3 # Copyright (C) 2006 Joshua Hoblitt3 # Copyright (C) 2006-2008 Joshua Hoblitt 4 4 # 5 # $Id: dsleech,v 1. 9 2008-02-22 01:50:43 jhoblitt Exp $5 # $Id: dsleech,v 1.10 2008-05-12 22:04:53 jhoblitt Exp $ 6 6 7 7 use strict; … … 18 18 use Pod::Usage qw( pod2usage ); 19 19 20 my ($dir, $uri, $last_fileset, $overwrite, $recall, $remember, $verbose );20 my ($dir, $uri, $last_fileset, $overwrite, $recall, $remember, $verbose, $timeout); 21 21 22 22 GetOptions( … … 28 28 'remember' => \$remember, 29 29 'verbose|v' => \$verbose, 30 'timeout|t' => \$timeout, 30 31 ) or pod2usage( 2 ); 31 32 … … 35 36 -exitval => 3, 36 37 ) unless defined $uri; 38 39 # default http request timeout is 30s 40 $timeout ||= 30; 37 41 38 42 my %p = ( … … 59 63 } 60 64 61 my $response = DataStore::Product->new(%p)->request; 65 my $response = DataStore::Product->new(%p)->request( 66 ua_args => { timeout => $timeout }, 67 ); 68 62 69 unless (defined $response->is_success) { 63 70 die "request failed: ", $response->status_line; … … 96 103 print "processing fileset: $fileset->fileset $n/@$filesets\n" if $verbose; 97 104 98 my $response = $fileset->request; 105 my $response = $fileset->request( 106 ua_args => { timeout => $timeout }, 107 ); 99 108 unless (defined $response->is_success) { 100 109 warn "request failed: ", $response->status_line; … … 155 164 print "fetching ", $file->fileid, "..." if $verbose; 156 165 157 my $response = $file->request( filename => $filename ); 166 my $response = $file->request( 167 filename => $filename, 168 ua_args => { timeout => $timeout }, 169 ); 158 170 unless (defined $response->is_success) { 159 171 warn "request failed: ", $response->status_line; … … 261 273 This flag is optional. 262 274 275 =item * --timeout|-t 276 277 The ammount of time (in seconds) to wait for a response from the DataStore 278 after making an HTTP request. The default is 30s. 279 280 Optional. 281 263 282 =back 264 283 … … 277 296 =head1 COPYRIGHT 278 297 279 Copyright (C) 2006 Joshua Hoblitt. All rights reserved.298 Copyright (C) 2006-2008 Joshua Hoblitt. All rights reserved. 280 299 281 300 This program is free software; you can redistribute it and/or modify it under … … 297 316 =head1 SEE ALSO 298 317 299 L<ds productls>, L<dsfilesetls>, L<dsget>, L<DataStore>318 L<dsget>, L<dsleech>, L<dsrootls>, L<dsproductls>, L<dsfilesetls>, L<DataStore> 300 319 301 320 =cut -
trunk/DataStore/scripts/dsproductls
r8707 r17637 1 1 #!/usr/bin/env perl 2 2 3 # Copyright (C) 2006 Joshua Hoblitt3 # Copyright (C) 2006-2008 Joshua Hoblitt 4 4 # 5 # $Id: dsproductls,v 1. 3 2006-08-30 22:45:53 jhoblitt Exp $5 # $Id: dsproductls,v 1.4 2008-05-12 22:04:53 jhoblitt Exp $ 6 6 7 7 use strict; … … 16 16 use Pod::Usage qw( pod2usage ); 17 17 18 my ($uri, $last_fileset );18 my ($uri, $last_fileset, $timeout); 19 19 20 20 GetOptions( 21 21 'uri|u=s' => \$uri, 22 22 'last_fileset|l=s' => \$last_fileset, 23 'timeout|t' => \$timeout, 23 24 ) or pod2usage( 2 ); 24 25 … … 29 30 ) unless defined $uri; 30 31 32 # default http request timeout is 30s 33 $timeout ||= 30; 34 31 35 my %p = ( 32 36 uri => $uri, … … 35 39 $p{last_fileset} = $last_fileset if defined $last_fileset; 36 40 37 my $response = DataStore::Product->new(%p)->request; 41 my $response = DataStore::Product->new(%p)->request( 42 ua_args => { timeout => $timeout }, 43 ); 38 44 39 45 die "request failed" unless defined $response; … … 82 88 This flag is optional. 83 89 90 =item * --timeout|-t 91 92 The ammount of time (in seconds) to wait for a response from the DataStore 93 after making an HTTP request. The default is 30s. 94 95 Optional. 96 84 97 =back 85 98 … … 98 111 =head1 COPYRIGHT 99 112 100 Copyright (C) 2006 Joshua Hoblitt. All rights reserved.113 Copyright (C) 2006-2008 Joshua Hoblitt. All rights reserved. 101 114 102 115 This program is free software; you can redistribute it and/or modify it under … … 118 131 =head1 SEE ALSO 119 132 120 L< DataStore>, L<DataStore::Product>, L<DataStore::FileSet>133 L<dsget>, L<dsleech>, L<dsrootls>, L<dsproductls>, L<dsfilesetls>, L<DataStore> 121 134 122 135 =cut -
trunk/DataStore/scripts/dsrootls
r14879 r17637 1 1 #!/usr/bin/env perl 2 2 3 # Copyright (C) 2006-200 7Joshua Hoblitt3 # Copyright (C) 2006-2008 Joshua Hoblitt 4 4 # 5 # $Id: dsrootls,v 1. 1 2007-09-18 04:15:09jhoblitt Exp $5 # $Id: dsrootls,v 1.2 2008-05-12 22:04:53 jhoblitt Exp $ 6 6 7 7 use strict; … … 16 16 use Pod::Usage qw( pod2usage ); 17 17 18 my ($uri );18 my ($uri, $timeout); 19 19 20 20 GetOptions( 21 'uri|u=s' => \$uri, 21 'uri|u=s' => \$uri, 22 'timeout|t' => \$timeout, 22 23 ) or pod2usage( 2 ); 23 24 … … 28 29 ) unless defined $uri; 29 30 31 # default http request timeout is 30s 32 $timeout ||= 30; 33 30 34 my %p = ( 31 35 uri => $uri, 32 36 ); 33 37 34 my $response = DataStore::Root->new(%p)->request; 38 my $response = DataStore::Root->new(%p)->request( 39 ua_args => { timeout => $timeout }, 40 ); 35 41 36 42 die "request failed" unless defined $response; … … 78 84 The URI of the file to be retrieved. 79 85 86 =item * --timeout|-t 87 88 The ammount of time (in seconds) to wait for a response from the DataStore 89 after making an HTTP request. The default is 30s. 90 91 Optional. 92 80 93 =back 81 94 … … 94 107 =head1 COPYRIGHT 95 108 96 Copyright (C) 2006-200 7Joshua Hoblitt. All rights reserved.109 Copyright (C) 2006-2008 Joshua Hoblitt. All rights reserved. 97 110 98 111 This program is free software; you can redistribute it and/or modify it under … … 114 127 =head1 SEE ALSO 115 128 116 L< DataStore>, L<DataStore::Product>, L<DataStore::FileSet>129 L<dsget>, L<dsleech>, L<dsrootls>, L<dsproductls>, L<dsfilesetls>, L<DataStore> 117 130 118 131 =cut
Note:
See TracChangeset
for help on using the changeset viewer.
