Changeset 24930
- Timestamp:
- Jul 28, 2009, 11:44:45 AM (17 years ago)
- Location:
- trunk/Nebulous
- Files:
-
- 1 added
- 4 edited
-
Changes (modified) (1 diff)
-
MANIFEST (modified) (1 diff)
-
lib/Nebulous/Client.pm (modified) (3 diffs)
-
lib/Nebulous/Client.pod (modified) (3 diffs)
-
t/71_client_there_can_be_only_one.t (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous/Changes
r24920 r24930 7 7 - change neb-locate's output seperator to \n 8 8 - add Nebulous::Client->prune() method 9 - add Nebulous::Client->there_can_be_only_one() method 9 10 10 11 0.10 -
trunk/Nebulous/MANIFEST
r24920 r24930 101 101 t/69_client_prune.t 102 102 t/70_neb-ls.t 103 t/71_client_there_can_be_only_one.t 103 104 t/90_nebclient.t 104 105 t/TEST.PL -
trunk/Nebulous/lib/Nebulous/Client.pm
r24927 r24930 360 360 361 361 my $locations; 362 my $removed = 0; 362 363 eval { 363 364 # first - strip off any inaccesible instances 364 $self->prune($key); 365 if (not defined $self->prune($key)) { 366 # use the prune() method to also determine if $key is valid 367 $removed = undef; 368 return; 369 } 365 370 366 371 # check to see if there is an instance on $vol_name that should be the … … 375 380 next if $victim eq $locations->[0]; 376 381 $self->delete_instance($key, $victim); 382 $removed++; 377 383 } 378 384 } else { 379 385 # nuke whatever 380 my @stats = $self->stat($key); 381 foreach (1 .. $stats[6]) { 386 my $stats = $self->stat($key); 387 # start at one so cull() is called one less time then the # of 388 # instances 389 for (my $i = 1; $i < $stats->[6]; $i++) { 382 390 $self->cull($key); 391 $removed++; 383 392 } 384 393 } … … 391 400 $log->debug("leaving"); 392 401 393 return $ locations->[0];402 return $removed; 394 403 } 395 404 -
trunk/Nebulous/lib/Nebulous/Client.pod
r24925 r24930 35 35 my $mounts = $neb->mounts(); 36 36 my $mode = $neb->chmod( $key, $mode ); 37 my $dead = $neb->prune( $key ); 37 my $n_dead = $neb->prune( $key ); 38 my $n_dead = $neb->there_can_be_only_one( $key, $vol ); 38 39 39 40 =head1 DESCRIPTION … … 419 420 =back 420 421 421 The number of inaccessible instances removed: 422 The number of instances removed. 423 424 =item * there_can_be_only_one($key, $vol) 425 426 Removes all but one instance of an object and automatically removes any 427 inaccessible instances. 428 429 =over 4 430 431 =item * key 432 433 The storage object key (name). 434 435 =item * vol 436 437 If specified, the only remaining instance will be left on this volume (if an 438 instance already exists there). 439 440 =back 441 442 The number of avaiable instances removed. 422 443 423 444 =item * mounts() … … 479 500 =head1 COPYRIGHT 480 501 481 Copyright (C) 2004-200 8Joshua Hoblitt. All rights reserved.502 Copyright (C) 2004-2009 Joshua Hoblitt. All rights reserved. 482 503 483 504 This program is free software; you can redistribute it and/or modify it under
Note:
See TracChangeset
for help on using the changeset viewer.
