Changeset 29906 for branches/eam_branches/ipp-20101103/Nebulous
- Timestamp:
- Dec 3, 2010, 2:35:32 AM (16 years ago)
- Location:
- branches/eam_branches/ipp-20101103/Nebulous
- Files:
-
- 2 edited
- 1 copied
-
Build.PL (modified) (1 diff)
-
bin/whichnode (copied) (copied from trunk/Nebulous/bin/whichnode )
-
lib/Nebulous/Client.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101103/Nebulous/Build.PL
r28446 r29906 122 122 bin/neb-touch 123 123 bin/neb-xattr 124 bin/whichnode 124 125 )], 125 126 )->create_build_script; -
branches/eam_branches/ipp-20101103/Nebulous/lib/Nebulous/Client.pm
r28525 r29906 379 379 { 380 380 # volume 381 type => SCALAR ,381 type => SCALAR|UNDEF, 382 382 optional => 1, 383 383 }, … … 401 401 } 402 402 403 # set the number of user copies to 1 to prevent replication 404 $self->setxattr($key, 'user.copies', 1, 'replace'); 405 403 406 if (defined $locations) { 404 my $instances = $self->find_instances($key); 405 if (scalar @$instances < 2) { 406 die "not enough instances"; 407 my $instances = $self->find_instances($key, undef, 'find them all'); 408 if (scalar @$instances == 1) { 409 # only one instance nothing to do 410 return 0; 411 } 412 if (scalar @$instances == 0) { 413 die "no instances"; 407 414 } 408 415 foreach my $victim (@$instances) { … … 416 423 # start at one so cull() is called one less time then the # of 417 424 # instances 418 if ($stats->[6] < 2) { 419 die "not enough instances"; 425 if ($stats->[6] == 1) { 426 # only one instance nothing to do 427 return 0; 428 } 429 if ($stats->[6] == 0) { 430 die "no instances"; 420 431 } 421 432 for (my $i = 1; $i < $stats->[6]; $i++) { … … 439 450 } 440 451 452 sub storage_object_exists 453 { 454 my $self = shift; 455 456 # HI! 457 458 my ($key) = validate_pos(@_, 459 { 460 type => SCALAR, 461 }, 462 ); 463 464 $log->debug( "entered - @_" ); 465 466 my $found = 0; 467 eval { 468 my $objects = $self->find_objects($key); 469 if ($objects) { 470 $found = (scalar @$objects) > 0; 471 } 472 }; 473 if ($@) { 474 if ($@ =~ qr/invalid key/) { 475 $self->set_err($@); 476 return; 477 } 478 $log->logdie($@); 479 } 480 481 $log->debug("leaving"); 482 483 return $found; 484 } 441 485 442 486 sub lock
Note:
See TracChangeset
for help on using the changeset viewer.
