Changeset 24557 for branches/eam_branches/20090522/Nebulous/lib
- Timestamp:
- Jun 25, 2009, 2:00:56 PM (17 years ago)
- Location:
- branches/eam_branches/20090522
- Files:
-
- 5 edited
-
. (modified) (1 prop)
-
Nebulous (modified) (1 prop)
-
Nebulous/lib (modified) (1 prop)
-
Nebulous/lib/Nebulous/Client.pm (modified) (8 diffs)
-
Nebulous/lib/Nebulous/Client.pod (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090522
- Property svn:mergeinfo changed
-
branches/eam_branches/20090522/Nebulous
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/20090522/Nebulous/lib
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/20090522/Nebulous/lib/Nebulous/Client.pm
r23934 r24557 9 9 no warnings qw( uninitialized ); 10 10 11 our $VERSION = '0. 09';11 our $VERSION = '0.17'; 12 12 13 13 use Digest::MD5; … … 16 16 use Nebulous::Client::Log; 17 17 use Nebulous::Util qw( :standard ); 18 use Params::Validate qw( validate validate_pos SCALAR UNDEF );18 use Params::Validate qw( validate validate_pos SCALAR UNDEF BOOLEAN ); 19 19 #use SOAP::Lite +trace => [qw( debug )]; 20 20 use SOAP::Lite; … … 329 329 my $uri = $self->delete_instance($key, @$locations[0]); 330 330 331 eval { 332 _nuke_file(_get_file_path(@$locations[0])); 333 }; 334 if ($@) { 335 $log->logdie($@); 336 } 337 331 338 $log->debug("leaving"); 332 339 … … 803 810 my $self = shift; 804 811 805 my ( $key ) = validate_pos( @_, 806 { 807 type => SCALAR, 812 my ($key, $force) = validate_pos( @_, 813 { 814 type => SCALAR, 815 }, 816 { 817 type => BOOLEAN, 818 optional => 1, 819 default => undef, 820 callbacks => { 821 'is boolean' => sub { 822 $_[0] == 0 or $_[0] == 1 or $_[0] == undef; 823 }, 824 }, 808 825 }, 809 826 ); … … 817 834 # a lock is implicitly removed when the last storage object is deleted 818 835 foreach my $uri ( @$locations ) { 836 # it is being assumed here that it is better to have files on disk and 837 # not in the database then the inverse. 838 my $path; 839 eval { 840 $path = _get_file_path( $uri ); 841 }; 842 if ($@) { 843 if ($force) { 844 $log->warn($@); 845 $log->warn("exception ignored because force is in effect"); 846 } else { 847 $log->logdie($@); 848 } 849 } 850 819 851 $self->delete_instance($key, $uri) or return undef; 852 853 eval { 854 _nuke_file( $path ); 855 }; 856 if ($@) { 857 if ($force) { 858 $log->warn($@); 859 $log->warn("exception ignored because force is in effect"); 860 } else { 861 $log->logdie($@); 862 } 863 } 820 864 } 821 865 … … 959 1003 $log->debug( "entered - @_" ); 960 1004 961 # it is being assumed here that it is better to have files on disk and not in962 # the database then the inverse.963 964 my $path;965 eval {966 $path = _get_file_path( $uri );967 };968 $log->logdie( $@ ) if $@;969 970 1005 my $response = $self->{ 'server' }->delete_instance($key, $uri); 971 1006 if ( $response->fault ) { … … 982 1017 $log->debug( "server deleted instance" ); 983 1018 984 eval {985 _nuke_file( $path );986 };987 $log->logdie( $@ ) if $@;988 989 1019 $log->debug( "leaving" ); 990 1020 … … 1045 1075 1046 1076 return $stats; 1077 } 1078 1079 1080 sub chmod 1081 { 1082 my $self = shift; 1083 1084 my ($key, $mode) = validate_pos( @_, 1085 { 1086 type => SCALAR, 1087 }, 1088 { 1089 type => SCALAR, 1090 regex => qr/\d{3,4}/, 1091 }, 1092 ); 1093 1094 $log->debug( "entered - @_" ); 1095 1096 my $response = $self->{ 'server' }->chmod_object($key, $mode); 1097 if ( $response->fault ) { 1098 $self->set_err($response->faultstring); 1099 if ($response->faultstring =~ /is valid object key/) { 1100 $log->debug( "leaving" ); 1101 return; 1102 } 1103 if ($response->faultstring =~ /is allowable mode/) { 1104 $log->debug( "leaving" ); 1105 return; 1106 } 1107 1108 $log->logdie("unhandled fault - ", $self->err); 1109 } 1110 1111 my $response_mode = $response->result; 1112 1113 $log->debug( "leaving" ); 1114 1115 return $response_mode; 1047 1116 } 1048 1117 -
branches/eam_branches/20090522/Nebulous/lib/Nebulous/Client.pod
r20094 r24557 13 13 ); 14 14 15 my $uri = $neb->create( "key", "node01");16 my $fh = $neb->open_create( "key", "node01");17 $neb->replicate( "key", "node01");18 $neb->cull( "key", "node01");19 $neb->lock( "key", 'write' );20 $neb->unlock( "key", 'write' );15 my $uri = $neb->create( $key, $vol ); 16 my $fh = $neb->open_create( $key, $vol ); 17 $neb->replicate( $key, $vol ); 18 $neb->cull( $key, $vol ); 19 $neb->lock( $key, 'write' ); 20 $neb->unlock( $key, 'write' ); 21 21 $neb->setxattr( $key, $name, $value, $flags ); 22 22 $neb->getxattr( $key, $name ); … … 24 24 $neb->removexattr( $key, $name ); 25 25 my $uris = $neb->find_objects( $pattern ); 26 my $uris = $neb->find_instances( "key", "node01");27 my $path = $neb->find( "key");28 my $fh = $neb->open( "key", 'read' );29 $neb->delete( "key");30 $neb->copy( "key", "new_key", "node01");31 $neb->move( "key", "new_key");32 $neb->swap( "key1", "key2");26 my $uris = $neb->find_instances( $key, $vol ); 27 my $path = $neb->find( $key ); 28 my $fh = $neb->open( $key, 'read' ); 29 $neb->delete( $key ); 30 $neb->copy( $key, $new_key, $vol ); 31 $neb->move( $key, $new_key ); 32 $neb->swap( $key1, $key2 ); 33 33 $neb->delete_instance( $uri ); 34 my $stats = $neb->stat( "key");34 my $stats = $neb->stat( $key ); 35 35 my $mounts = $neb->mounts(); 36 my $mode = $neb->chmod( $key, $mode ); 36 37 37 38 =head1 DESCRIPTION … … 425 426 ] 426 427 428 =item * chmod( $key, $mode ); 429 430 Accepts 2 parameters, both mandatory. C<$key> is the nebulous key to operate 431 on and C<$mode> are the POSIX like file permissions to set on all instances of 432 C<$key>. C<$mode> must be specified in oct. Returns C<$mode> or sucess or an 433 exception on failure. 434 427 435 =back 428 436
Note:
See TracChangeset
for help on using the changeset viewer.
