IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20987


Ignore:
Timestamp:
Dec 14, 2008, 12:19:16 PM (17 years ago)
Author:
eugene
Message:

revert to HEAD

Location:
branches/neb_single_20081210/Nebulous
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/neb_single_20081210/Nebulous/lib/Nebulous/Client.pm

    r20094 r20987  
    11# Copyright (c) 2004-2008  Joshua Hoblitt
    22#
    3 # $Id: Client.pm,v 1.62 2008-10-13 21:20:33 jhoblitt Exp $
     3# $Id: Client.pm,v 1.62.8.1 2008-12-14 22:19:16 eugene Exp $
    44
    55package Nebulous::Client;
     
    243243        # if the copy failed we now have a zero length instances floating
    244244        # around that must be removed
    245         unless ($self->delete_instance("$uri")) {
     245        unless ($self->delete_instance($key, "$uri")) {
    246246            $log->logdie( "can not copy instance $uri AND FAILED TO CLEANUP EMPTY INSTANCE" );
    247247        }
     
    256256
    257257    unless ($src_md5 eq $dst_md5) {
    258         $self->delete_instance("$uri");
     258        $self->delete_instance($key, "$uri");
    259259        $log->logdie( "md5sum mismatch" );
    260260    }
     
    327327    }
    328328
    329     my $uri = $self->delete_instance( @$locations[0] );
     329    my $uri = $self->delete_instance($key, @$locations[0]);
    330330
    331331    $log->debug("leaving");
     
    813813    # a lock is implicitly removed when the last storage object is deleted
    814814    foreach my $uri ( @$locations ) {
    815         $self->delete_instance( $uri ) or return undef;
     815        $self->delete_instance($key, $uri) or return undef;
    816816    }
    817817
     
    944944    my $self = shift;
    945945
    946     my ($uri) = validate_pos(@_,
     946    my ($key, $uri) = validate_pos(@_,
     947        {
     948            type => SCALAR,
     949        },
    947950        {
    948951            type => SCALAR,
     
    961964    $log->logdie( $@ ) if $@;
    962965
    963     my $response = $self->{ 'server' }->delete_instance( $uri );
     966    my $response = $self->{ 'server' }->delete_instance($key, $uri);
    964967    if ( $response->fault ) {
    965968        $self->set_err($response->faultstring);
  • branches/neb_single_20081210/Nebulous/nebclient/nebulous.wsdl

    r20901 r20987  
    125125
    126126    <message name="delete_instanceRequest">
     127        <part name="key" type="xsd:string" />
    127128        <part name="uri" type="xsd:string" />
    128129    </message>
  • branches/neb_single_20081210/Nebulous/nebclient/src/nebclient.c

    r20344 r20987  
    44 * Copyright (C) 2005  Joshua Hoblitt
    55 *
    6  * $Id: nebclient.c,v 1.54 2008-10-23 22:30:44 bills Exp $
     6 * $Id: nebclient.c,v 1.54.8.1 2008-12-14 22:19:16 eugene Exp $
    77 */
    88
     
    253253    }
    254254
    255     if (!nebDeleteInstance(server, locations->URI[0])) {
     255    if (!nebDeleteInstance(server, key, locations->URI[0])) {
    256256        nebObjectInstancesFree(locations);
    257257
     
    539539
    540540    for (int i = 0; i < locations->n; i++) {
    541         if (!nebDeleteInstance(server, locations->URI[i])) {
     541        if (!nebDeleteInstance(server, key, locations->URI[i])) {
    542542            nebSetErr(server, "can not delete instance");
    543543            nebObjectInstancesFree(locations);
     
    655655}
    656656
    657 bool nebDeleteInstance(nebServer *server, const char *URI)
     657bool nebDeleteInstance(nebServer *server, const char *key, const char *URI)
    658658{
    659659    int             response;
     
    676676
    677677    if (soap_call_ns1__delete_USCOREinstance(server->soap, server->endpoint,
    678             NULL, (char *)URI, &response) != SOAP_OK) {
     678            NULL, (char *)key, (char *)URI, &response) != SOAP_OK) {
    679679        nebFree(filename);
    680680
  • branches/neb_single_20081210/Nebulous/nebclient/src/nebclient.h

    r20344 r20987  
    44 * Copyright (C) 2005  Joshua Hoblitt
    55 *
    6  * $Id: nebclient.h,v 1.36 2008-10-23 22:30:44 bills Exp $
     6 * $Id: nebclient.h,v 1.36.8.1 2008-12-14 22:19:16 eugene Exp $
    77 */
    88
     
    248248bool nebDeleteInstance(
    249249    nebServer *server,                  ///< nebServer object
     250    const char *key,                    ///< storage object key (name)
    250251    const char *URI                     ///< URL of instance to remove
    251252);
  • branches/neb_single_20081210/Nebulous/nebclient/src/nebulous.h

    r20208 r20987  
    11/* src/nebulous.h
    22   Generated by wsdl2h 1.2.11 from nebulous.wsdl and typemap.dat
    3    2008-10-16 23:26:37 GMT
     3   2008-12-11 21:42:13 GMT
    44   Copyright (C) 2001-2008 Robert van Engelen, Genivia Inc. All Rights Reserved.
    55   This part of the software is released under one of the following licenses:
     
    808808    NULL, // char *action = NULL selects default action for this operation
    809809    // request parameters:
     810    char*                               key,
    810811    char*                               uri,
    811812    // response parameters:
     
    819820    struct soap *soap,
    820821    // request parameters:
     822    char*                               key,
    821823    char*                               uri,
    822824    // response parameters:
     
    831833//gsoap ns1  service method-action:     delete_USCOREinstance urn:Nebulous/Server/SOAP#delete_instance
    832834int ns1__delete_USCOREinstance(
     835    char*                               key,    ///< Request parameter
    833836    char*                               uri,    ///< Request parameter
    834837    int                                *result  ///< Response parameter
  • branches/neb_single_20081210/Nebulous/nebclient/src/soapC.c

    r20208 r20987  
    1212#endif
    1313
    14 SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.11 2008-10-16 23:26:39 GMT")
     14SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.11 2008-12-11 21:42:14 GMT")
    1515
    1616
     
    13421342{
    13431343        (void)soap; (void)a; /* appease -Wall -Werror */
     1344        soap_default_string(soap, &a->key);
    13441345        soap_default_string(soap, &a->uri);
    13451346}
     
    13481349{
    13491350        (void)soap; (void)a; /* appease -Wall -Werror */
     1351        soap_serialize_string(soap, &a->key);
    13501352        soap_serialize_string(soap, &a->uri);
    13511353}
     
    13631365        if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__delete_USCOREinstance), type))
    13641366                return soap->error;
     1367        if (soap_out_string(soap, "key", -1, &a->key, ""))
     1368                return soap->error;
    13651369        if (soap_out_string(soap, "uri", -1, &a->uri, ""))
    13661370                return soap->error;
     
    13781382SOAP_FMAC3 struct ns1__delete_USCOREinstance * SOAP_FMAC4 soap_in_ns1__delete_USCOREinstance(struct soap *soap, const char *tag, struct ns1__delete_USCOREinstance *a, const char *type)
    13791383{
     1384        size_t soap_flag_key = 1;
    13801385        size_t soap_flag_uri = 1;
    13811386        if (soap_element_begin_in(soap, tag, 0, type))
     
    13891394                for (;;)
    13901395                {       soap->error = SOAP_TAG_MISMATCH;
     1396                        if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG))
     1397                                if (soap_in_string(soap, "key", &a->key, "xsd:string"))
     1398                                {       soap_flag_key--;
     1399                                        continue;
     1400                                }
    13911401                        if (soap_flag_uri && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG))
    13921402                                if (soap_in_string(soap, "uri", &a->uri, "xsd:string"))
  • branches/neb_single_20081210/Nebulous/nebclient/src/soapClient.c

    r20208 r20987  
    1010#endif
    1111
    12 SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.11 2008-10-16 23:26:38 GMT")
     12SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.11 2008-12-11 21:42:13 GMT")
    1313
    1414
     
    700700}
    701701
    702 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__delete_USCOREinstance(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *uri, int *result)
     702SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__delete_USCOREinstance(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, char *uri, int *result)
    703703{       struct ns1__delete_USCOREinstance soap_tmp_ns1__delete_USCOREinstance;
    704704        struct ns1__delete_USCOREinstanceResponse *soap_tmp_ns1__delete_USCOREinstanceResponse;
     
    708708                soap_action = "urn:Nebulous/Server/SOAP#delete_instance";
    709709        soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/";
     710        soap_tmp_ns1__delete_USCOREinstance.key = key;
    710711        soap_tmp_ns1__delete_USCOREinstance.uri = uri;
    711712        soap_begin(soap);
  • branches/neb_single_20081210/Nebulous/nebclient/src/soapServer.c

    r20208 r20987  
    1010#endif
    1111
    12 SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.11 2008-10-16 23:26:38 GMT")
     12SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.11 2008-12-11 21:42:13 GMT")
    1313
    1414
     
    643643         || soap_end_recv(soap))
    644644                return soap->error;
    645         soap->error = ns1__delete_USCOREinstance(soap, soap_tmp_ns1__delete_USCOREinstance.uri, &soap_tmp_int);
     645        soap->error = ns1__delete_USCOREinstance(soap, soap_tmp_ns1__delete_USCOREinstance.key, soap_tmp_ns1__delete_USCOREinstance.uri, &soap_tmp_int);
    646646        if (soap->error)
    647647                return soap->error;
  • branches/neb_single_20081210/Nebulous/nebclient/src/soapStub.h

    r20208 r20987  
    283283struct ns1__delete_USCOREinstance
    284284{
     285        char *key;      /* optional element of type xsd:string */
    285286        char *uri;      /* optional element of type xsd:string */
    286287};
     
    432433SOAP_FMAC5 int SOAP_FMAC6 ns1__find_USCOREinstances(struct soap*, char *key, char *volume, struct ns1__find_USCOREinstancesResponse *_param_3);
    433434
    434 SOAP_FMAC5 int SOAP_FMAC6 ns1__delete_USCOREinstance(struct soap*, char *uri, int *result);
     435SOAP_FMAC5 int SOAP_FMAC6 ns1__delete_USCOREinstance(struct soap*, char *key, char *uri, int *result);
    435436
    436437SOAP_FMAC5 int SOAP_FMAC6 ns1__stat_USCOREobject(struct soap*, char *key, struct ns1__stat_USCOREobjectResponse *_param_4);
     
    467468SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__find_USCOREinstances(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, char *volume, struct ns1__find_USCOREinstancesResponse *_param_3);
    468469
    469 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__delete_USCOREinstance(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *uri, int *result);
     470SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__delete_USCOREinstance(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, char *uri, int *result);
    470471
    471472SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__stat_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, struct ns1__stat_USCOREobjectResponse *_param_4);
  • branches/neb_single_20081210/Nebulous/t/62_client_delete_instance.t

    r5667 r20987  
    33# Copryight (C) 2004-2005  Joshua Hoblitt
    44#
    5 # $Id: 62_client_delete_instance.t,v 1.1 2005-12-03 02:52:31 jhoblitt Exp $
     5# $Id: 62_client_delete_instance.t,v 1.1.40.1 2008-12-14 22:19:16 eugene Exp $
    66
    77use strict;
     
    1010use Apache::Test qw( -withtestmore );
    1111
    12 plan tests => 9;
     12plan tests => 11;
    1313
    1414use lib qw( ./t ./lib );
     
    2626        proxy => "http://$hostport/nebulous",
    2727    );
    28     $neb->create( "foo" );
    2928
    30     my $locations = $neb->find_instances( "foo" );
     29    my $key = "foo";
     30    $neb->create($key);
    3131
    32     my $uri = $neb->delete_instance( @$locations[0] );
     32    my $locations = $neb->find_instances($key);
     33
     34    my $uri = $neb->delete_instance($key, @$locations[0]);
    3335
    3436    is( $uri, @$locations[0], "delete instance" );
     
    4345        proxy => "http://$hostport/nebulous",
    4446    );
    45     $neb->create( "foo" );
    46     $neb->replicate( "foo" );
     47    my $key = "foo";
     48    $neb->create($key);
     49    $neb->replicate($key);
    4750
    4851    my $uri1 = $neb->find_instances( "foo" )->[0];
    4952
    50     ok( $neb->delete_instance( $uri1 ), "delete instance" );
     53    ok( $neb->delete_instance($key, $uri1), "delete instance" );
    5154
    5255    my $uri2 = $neb->find_instances( "foo" )->[0];
     
    5457    isnt( $uri1, $uri2, "other instance remains" );
    5558
    56     ok( $neb->delete_instance( $uri2 ), "delete instance" );
     59    ok( $neb->delete_instance($key, $uri2), "delete instance" );
    5760
    5861    my $locations = $neb->find_instances( "foo" );
    5962
    60     is( $locations, undef, "no remaning instances" );
     63    is( $locations, undef, "no remaining instances" );
    6164}
     65
     66Test::Nebulous->setup;
    6267
    6368{
     
    6570        proxy => "http://$hostport/nebulous",
    6671    );
    67     my $uri = $neb->delete_instance( "file:/foo" );
     72    my $key = "foo";
     73    $neb->create($key);
     74    my $uri = $neb->delete_instance($key, "file:/foo" );
    6875
    6976    is( $uri, undef, "uri does not exist" );
     
    7683        proxy => "http://$hostport/nebulous",
    7784    );
    78     $neb->delete_instance();
     85    my $uri = $neb->delete_instance("foo", "file:/foo" );
    7986};
    80 like( $@, qr/1 was expected/, "no params" );
     87like( $@, qr/is valid object key/, "bad object key" );
    8188
    8289Test::Nebulous->setup;
     
    8693        proxy => "http://$hostport/nebulous",
    8794    );
    88     $neb->delete_instance( "foo", 2 );
     95    my $uri = $neb->delete_instance("foo");
    8996};
    90 like( $@, qr/1 was expected/, "too many params" );
     97like( $@, qr/2 were expected/, "missing second param" );
     98
     99Test::Nebulous->setup;
     100
     101eval {
     102    my $neb = Nebulous::Client->new(
     103        proxy => "http://$hostport/nebulous",
     104    );
     105    $neb->delete_instance();
     106};
     107like( $@, qr/2 were expected/, "no params" );
     108
     109Test::Nebulous->setup;
     110
     111eval {
     112    my $neb = Nebulous::Client->new(
     113        proxy => "http://$hostport/nebulous",
     114    );
     115    $neb->delete_instance("foo", 2, 3);
     116};
     117like( $@, qr/2 were expected/, "too many params" );
    91118
    92119Test::Nebulous->cleanup;
Note: See TracChangeset for help on using the changeset viewer.