Changeset 13067
- Timestamp:
- Apr 27, 2007, 1:50:57 PM (19 years ago)
- Location:
- trunk/Nebulous
- Files:
-
- 3 edited
-
lib/Nebulous/Client.pm (modified) (4 diffs)
-
lib/Nebulous/Client.pod (modified) (3 diffs)
-
t/60_client_copy.t (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous/lib/Nebulous/Client.pm
r13058 r13067 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Client.pm,v 1.2 6 2007-04-27 21:30:16jhoblitt Exp $3 # $Id: Client.pm,v 1.27 2007-04-27 23:50:57 jhoblitt Exp $ 4 4 5 5 package Nebulous::Client; … … 583 583 my $self = shift; 584 584 585 my ( $key, $new_key ) = validate_pos( @_,585 my ( $key, $new_key, $volume ) = validate_pos( @_, 586 586 { 587 587 type => SCALAR, … … 589 589 { 590 590 type => SCALAR, 591 }, 592 { 593 #volume 594 type => SCALAR, 595 optional => 1, 591 596 }, 592 597 ); … … 602 607 } 603 608 604 my $new_fh = $self->open_create( $new_key ); 609 my $new_fh; 610 if (defined $volume) { 611 $new_fh = $self->open_create( $new_key, 0, $volume ); 612 } else { 613 $new_fh = $self->open_create( $new_key ); 614 } 605 615 unless ( $new_fh ) { 606 616 $log->debug( "can not open object" ); -
trunk/Nebulous/lib/Nebulous/Client.pod
r13058 r13067 24 24 my $fh = $neb->open( "key", 'read' ); 25 25 $data->delete( "key" ); 26 $data->copy( "key", "new_key" );26 $data->copy( "key", "new_key", "node01" ); 27 27 $data->move( "key", "new_key" ); 28 28 $data->delete_instance( $uri ); … … 330 330 331 331 332 =item * copy($key, $new_key )332 =item * copy($key, $new_key, $volume) 333 333 334 334 Copy a storage object. … … 343 343 344 344 The destination object. 345 346 =item * volume 347 348 The preferred storage location of the new instance. 349 350 This parameter is optional. 345 351 346 352 =back -
trunk/Nebulous/t/60_client_copy.t
r5667 r13067 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 60_client_copy.t,v 1. 1 2005-12-03 02:52:31jhoblitt Exp $5 # $Id: 60_client_copy.t,v 1.2 2007-04-27 23:50:57 jhoblitt Exp $ 6 6 7 7 use strict; … … 10 10 use Apache::Test qw( -withtestmore ); 11 11 12 plan tests => 8;12 plan tests => 11; 13 13 14 14 use lib qw( ./t ./lib ); … … 43 43 proxy => "http://$hostport/nebulous", 44 44 ); 45 $neb->create( "foo" ); 46 47 ok( $neb->copy( "foo", "foobar", "node01" ), "copied object" ); 48 49 my $locations1 = $neb->find_instances( "foobar" ); 50 my $locations2 = $neb->find_instances( "foobar" ); 51 52 is( scalar @$locations1, 1, "old object has an instances" ); 53 is( scalar @$locations2, 1, "new object has an instances" ); 54 } 55 56 Test::Nebulous->setup; 57 58 { 59 my $neb = Nebulous::Client->new( 60 proxy => "http://$hostport/nebulous", 61 ); 45 62 46 63 ok( ! $neb->copy( "foo", "foobar" ), "copy non-existant object" ); … … 59 76 $neb->copy(); 60 77 }; 61 like( $@, qr/2 were expected/, "no params" );78 like( $@, qr/2 - 3 were expected/, "no params" ); 62 79 63 80 Test::Nebulous->setup; … … 69 86 $neb->copy( "foo" ); 70 87 }; 71 like( $@, qr/2 were expected/, "not enough params" );88 like( $@, qr/2 - 3 were expected/, "not enough params" ); 72 89 73 90 Test::Nebulous->setup; … … 77 94 proxy => "http://$hostport/nebulous", 78 95 ); 79 $neb->copy( "foo", "bar", "baz" );96 $neb->copy( "foo", "bar", "baz", "bong" ); 80 97 }; 81 like( $@, qr/2 were expected/, "too many params" );98 like( $@, qr/2 - 3 were expected/, "too many params" ); 82 99 83 100 Test::Nebulous->cleanup;
Note:
See TracChangeset
for help on using the changeset viewer.
