IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20094


Ignore:
Timestamp:
Oct 13, 2008, 11:20:33 AM (18 years ago)
Author:
jhoblitt
Message:

add Nebulous::Client->swap() method

Location:
trunk/Nebulous
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/Changes

    r19715 r20094  
    66      no instance
    77    - retry all calls to open()
     8    - add Nebulous::Client->swap() method
    89
    9100.09 Wed Jul  9 16:36:27 HST 2008
  • trunk/Nebulous/MANIFEST

    r18316 r20094  
    102102t/65_client_mounts.t
    103103t/66_client_xattr.t
     104t/67_client_swap.t
    104105t/90_nebclient.t
    105106t/TEST.PL
  • trunk/Nebulous/lib/Nebulous/Client.pm

    r20093 r20094  
    11# Copyright (c) 2004-2008  Joshua Hoblitt
    22#
    3 # $Id: Client.pm,v 1.61 2008-10-13 20:54:49 jhoblitt Exp $
     3# $Id: Client.pm,v 1.62 2008-10-13 21:20:33 jhoblitt Exp $
    44
    55package Nebulous::Client;
     
    907907
    908908
     909sub swap
     910{
     911    my $self = shift;
     912
     913    my ( $key1, $key2 ) = validate_pos( @_,
     914        {
     915            type => SCALAR,
     916        },
     917        {
     918            type => SCALAR,
     919        },
     920    );
     921
     922    $log->debug( "entered - @_" );
     923
     924    my $response = $self->{ 'server' }->swap_objects( $key1, $key2 );
     925    if ( $response->fault ) {
     926        $self->set_err($response->faultstring);
     927
     928        if ($response->faultstring =~ /is valid object key/) {
     929            $log->debug( "leaving" );
     930            return;
     931        }
     932
     933        $log->logdie("unhandled fault - ", $self->err);
     934    }
     935
     936    $log->debug( "leaving" );
     937
     938    return 1;
     939}
     940
     941
    909942sub delete_instance
    910943{
  • trunk/Nebulous/lib/Nebulous/Client.pod

    r17736 r20094  
    3030    $neb->copy( "key", "new_key", "node01" );
    3131    $neb->move( "key", "new_key" );
     32    $neb->swap( "key1", "key2" );
    3233    $neb->delete_instance( $uri );
    3334    my $stats = $neb->stat( "key" );
     
    349350
    350351=item * new_key
     352
     353The destination object.
     354
     355=back
     356
     357Returns true on success or C<undef> on failure.
     358
     359
     360=item * swap($key1, $key2)
     361
     362Atomically swaps the names of two storage objects.
     363
     364=over 4
     365
     366=item * key1
     367
     368The source object.
     369
     370=item * key2
    351371
    352372The destination object.
Note: See TracChangeset for help on using the changeset viewer.