Changeset 20988
- Timestamp:
- Dec 14, 2008, 12:48:35 PM (17 years ago)
- Location:
- trunk/Nebulous
- Files:
-
- 10 edited
-
lib/Nebulous/Client.pm (modified) (7 diffs)
-
nebclient/nebulous.wsdl (modified) (1 diff)
-
nebclient/src/nebclient.c (modified) (5 diffs)
-
nebclient/src/nebclient.h (modified) (2 diffs)
-
nebclient/src/nebulous.h (modified) (4 diffs)
-
nebclient/src/soapC.c (modified) (6 diffs)
-
nebclient/src/soapClient.c (modified) (3 diffs)
-
nebclient/src/soapServer.c (modified) (2 diffs)
-
nebclient/src/soapStub.h (modified) (3 diffs)
-
t/62_client_delete_instance.t (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous/lib/Nebulous/Client.pm
r20965 r20988 1 1 # Copyright (c) 2004-2008 Joshua Hoblitt 2 2 # 3 # $Id: Client.pm,v 1.6 3 2008-12-12 21:13:41 jhoblittExp $3 # $Id: Client.pm,v 1.64 2008-12-14 22:48:35 eugene Exp $ 4 4 5 5 package Nebulous::Client; … … 243 243 # if the copy failed we now have a zero length instances floating 244 244 # around that must be removed 245 unless ($self->delete_instance( $key,"$uri")) {245 unless ($self->delete_instance("$uri")) { 246 246 $log->logdie( "can not copy instance $uri AND FAILED TO CLEANUP EMPTY INSTANCE" ); 247 247 } … … 256 256 257 257 unless ($src_md5 eq $dst_md5) { 258 $self->delete_instance( $key,"$uri");258 $self->delete_instance("$uri"); 259 259 $log->logdie( "md5sum mismatch" ); 260 260 } … … 327 327 } 328 328 329 my $uri = $self->delete_instance( $key, @$locations[0]);329 my $uri = $self->delete_instance( @$locations[0] ); 330 330 331 331 $log->debug("leaving"); … … 813 813 # a lock is implicitly removed when the last storage object is deleted 814 814 foreach my $uri ( @$locations ) { 815 $self->delete_instance( $key, $uri) or return undef;815 $self->delete_instance( $uri ) or return undef; 816 816 } 817 817 … … 944 944 my $self = shift; 945 945 946 my ($key, $uri) = validate_pos(@_, 947 { 948 type => SCALAR, 949 }, 946 my ($uri) = validate_pos(@_, 950 947 { 951 948 type => SCALAR, … … 964 961 $log->logdie( $@ ) if $@; 965 962 966 my $response = $self->{ 'server' }->delete_instance( $key, $uri);963 my $response = $self->{ 'server' }->delete_instance( $uri ); 967 964 if ( $response->fault ) { 968 965 $self->set_err($response->faultstring); -
trunk/Nebulous/nebclient/nebulous.wsdl
r20965 r20988 125 125 126 126 <message name="delete_instanceRequest"> 127 <part name="key" type="xsd:string" />128 127 <part name="uri" type="xsd:string" /> 129 128 </message> -
trunk/Nebulous/nebclient/src/nebclient.c
r20965 r20988 4 4 * Copyright (C) 2005 Joshua Hoblitt 5 5 * 6 * $Id: nebclient.c,v 1.5 5 2008-12-12 21:13:41 jhoblittExp $6 * $Id: nebclient.c,v 1.56 2008-12-14 22:48:35 eugene Exp $ 7 7 */ 8 8 … … 253 253 } 254 254 255 if (!nebDeleteInstance(server, key,locations->URI[0])) {255 if (!nebDeleteInstance(server, locations->URI[0])) { 256 256 nebObjectInstancesFree(locations); 257 257 … … 539 539 540 540 for (int i = 0; i < locations->n; i++) { 541 if (!nebDeleteInstance(server, key,locations->URI[i])) {541 if (!nebDeleteInstance(server, locations->URI[i])) { 542 542 nebSetErr(server, "can not delete instance"); 543 543 nebObjectInstancesFree(locations); … … 655 655 } 656 656 657 bool nebDeleteInstance(nebServer *server, const char * key, const char *URI)657 bool nebDeleteInstance(nebServer *server, const char *URI) 658 658 { 659 659 int response; … … 676 676 677 677 if (soap_call_ns1__delete_USCOREinstance(server->soap, server->endpoint, 678 NULL, (char *) key, (char *)URI, &response) != SOAP_OK) {678 NULL, (char *)URI, &response) != SOAP_OK) { 679 679 nebFree(filename); 680 680 -
trunk/Nebulous/nebclient/src/nebclient.h
r20965 r20988 4 4 * Copyright (C) 2005 Joshua Hoblitt 5 5 * 6 * $Id: nebclient.h,v 1.3 7 2008-12-12 21:13:41 jhoblittExp $6 * $Id: nebclient.h,v 1.38 2008-12-14 22:48:35 eugene Exp $ 7 7 */ 8 8 … … 248 248 bool nebDeleteInstance( 249 249 nebServer *server, ///< nebServer object 250 const char *key, ///< storage object key (name)251 250 const char *URI ///< URL of instance to remove 252 251 ); -
trunk/Nebulous/nebclient/src/nebulous.h
r20965 r20988 1 1 /* src/nebulous.h 2 2 Generated by wsdl2h 1.2.11 from nebulous.wsdl and typemap.dat 3 2008-1 2-11 21:42:13GMT3 2008-10-16 23:26:37 GMT 4 4 Copyright (C) 2001-2008 Robert van Engelen, Genivia Inc. All Rights Reserved. 5 5 This part of the software is released under one of the following licenses: … … 808 808 NULL, // char *action = NULL selects default action for this operation 809 809 // request parameters: 810 char* key,811 810 char* uri, 812 811 // response parameters: … … 820 819 struct soap *soap, 821 820 // request parameters: 822 char* key,823 821 char* uri, 824 822 // response parameters: … … 833 831 //gsoap ns1 service method-action: delete_USCOREinstance urn:Nebulous/Server/SOAP#delete_instance 834 832 int ns1__delete_USCOREinstance( 835 char* key, ///< Request parameter836 833 char* uri, ///< Request parameter 837 834 int *result ///< Response parameter -
trunk/Nebulous/nebclient/src/soapC.c
r20965 r20988 12 12 #endif 13 13 14 SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.11 2008-1 2-11 21:42:14GMT")14 SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.11 2008-10-16 23:26:39 GMT") 15 15 16 16 … … 1342 1342 { 1343 1343 (void)soap; (void)a; /* appease -Wall -Werror */ 1344 soap_default_string(soap, &a->key);1345 1344 soap_default_string(soap, &a->uri); 1346 1345 } … … 1349 1348 { 1350 1349 (void)soap; (void)a; /* appease -Wall -Werror */ 1351 soap_serialize_string(soap, &a->key);1352 1350 soap_serialize_string(soap, &a->uri); 1353 1351 } … … 1365 1363 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__delete_USCOREinstance), type)) 1366 1364 return soap->error; 1367 if (soap_out_string(soap, "key", -1, &a->key, ""))1368 return soap->error;1369 1365 if (soap_out_string(soap, "uri", -1, &a->uri, "")) 1370 1366 return soap->error; … … 1382 1378 SOAP_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) 1383 1379 { 1384 size_t soap_flag_key = 1;1385 1380 size_t soap_flag_uri = 1; 1386 1381 if (soap_element_begin_in(soap, tag, 0, type)) … … 1394 1389 for (;;) 1395 1390 { 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 }1401 1391 if (soap_flag_uri && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1402 1392 if (soap_in_string(soap, "uri", &a->uri, "xsd:string")) -
trunk/Nebulous/nebclient/src/soapClient.c
r20965 r20988 10 10 #endif 11 11 12 SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.11 2008-1 2-11 21:42:13GMT")12 SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.11 2008-10-16 23:26:38 GMT") 13 13 14 14 … … 700 700 } 701 701 702 SOAP_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)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) 703 703 { struct ns1__delete_USCOREinstance soap_tmp_ns1__delete_USCOREinstance; 704 704 struct ns1__delete_USCOREinstanceResponse *soap_tmp_ns1__delete_USCOREinstanceResponse; … … 708 708 soap_action = "urn:Nebulous/Server/SOAP#delete_instance"; 709 709 soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"; 710 soap_tmp_ns1__delete_USCOREinstance.key = key;711 710 soap_tmp_ns1__delete_USCOREinstance.uri = uri; 712 711 soap_begin(soap); -
trunk/Nebulous/nebclient/src/soapServer.c
r20965 r20988 10 10 #endif 11 11 12 SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.11 2008-1 2-11 21:42:13GMT")12 SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.11 2008-10-16 23:26:38 GMT") 13 13 14 14 … … 643 643 || soap_end_recv(soap)) 644 644 return soap->error; 645 soap->error = ns1__delete_USCOREinstance(soap, soap_tmp_ns1__delete_USCOREinstance. key, soap_tmp_ns1__delete_USCOREinstance.uri, &soap_tmp_int);645 soap->error = ns1__delete_USCOREinstance(soap, soap_tmp_ns1__delete_USCOREinstance.uri, &soap_tmp_int); 646 646 if (soap->error) 647 647 return soap->error; -
trunk/Nebulous/nebclient/src/soapStub.h
r20965 r20988 283 283 struct ns1__delete_USCOREinstance 284 284 { 285 char *key; /* optional element of type xsd:string */286 285 char *uri; /* optional element of type xsd:string */ 287 286 }; … … 433 432 SOAP_FMAC5 int SOAP_FMAC6 ns1__find_USCOREinstances(struct soap*, char *key, char *volume, struct ns1__find_USCOREinstancesResponse *_param_3); 434 433 435 SOAP_FMAC5 int SOAP_FMAC6 ns1__delete_USCOREinstance(struct soap*, char * key, char *uri, int *result);434 SOAP_FMAC5 int SOAP_FMAC6 ns1__delete_USCOREinstance(struct soap*, char *uri, int *result); 436 435 437 436 SOAP_FMAC5 int SOAP_FMAC6 ns1__stat_USCOREobject(struct soap*, char *key, struct ns1__stat_USCOREobjectResponse *_param_4); … … 468 467 SOAP_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); 469 468 470 SOAP_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);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); 471 470 472 471 SOAP_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); -
trunk/Nebulous/t/62_client_delete_instance.t
r20965 r20988 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 62_client_delete_instance.t,v 1. 2 2008-12-12 21:13:41 jhoblittExp $5 # $Id: 62_client_delete_instance.t,v 1.3 2008-12-14 22:48:35 eugene Exp $ 6 6 7 7 use strict; … … 10 10 use Apache::Test qw( -withtestmore ); 11 11 12 plan tests => 11;12 plan tests => 9; 13 13 14 14 use lib qw( ./t ./lib ); … … 26 26 proxy => "http://$hostport/nebulous", 27 27 ); 28 $neb->create( "foo" ); 28 29 29 my $key = "foo"; 30 $neb->create($key); 30 my $locations = $neb->find_instances( "foo" ); 31 31 32 my $locations = $neb->find_instances($key); 33 34 my $uri = $neb->delete_instance($key, @$locations[0]); 32 my $uri = $neb->delete_instance( @$locations[0] ); 35 33 36 34 is( $uri, @$locations[0], "delete instance" ); … … 45 43 proxy => "http://$hostport/nebulous", 46 44 ); 47 my $key = "foo"; 48 $neb->create($key); 49 $neb->replicate($key); 45 $neb->create( "foo" ); 46 $neb->replicate( "foo" ); 50 47 51 48 my $uri1 = $neb->find_instances( "foo" )->[0]; 52 49 53 ok( $neb->delete_instance( $key, $uri1), "delete instance" );50 ok( $neb->delete_instance( $uri1 ), "delete instance" ); 54 51 55 52 my $uri2 = $neb->find_instances( "foo" )->[0]; … … 57 54 isnt( $uri1, $uri2, "other instance remains" ); 58 55 59 ok( $neb->delete_instance( $key, $uri2), "delete instance" );56 ok( $neb->delete_instance( $uri2 ), "delete instance" ); 60 57 61 58 my $locations = $neb->find_instances( "foo" ); 62 59 63 is( $locations, undef, "no rema ining instances" );60 is( $locations, undef, "no remaning instances" ); 64 61 } 65 66 Test::Nebulous->setup;67 62 68 63 { … … 70 65 proxy => "http://$hostport/nebulous", 71 66 ); 72 my $key = "foo"; 73 $neb->create($key); 74 my $uri = $neb->delete_instance($key, "file:/foo" ); 67 my $uri = $neb->delete_instance( "file:/foo" ); 75 68 76 69 is( $uri, undef, "uri does not exist" ); … … 83 76 proxy => "http://$hostport/nebulous", 84 77 ); 85 my $uri = $neb->delete_instance("foo", "file:/foo");78 $neb->delete_instance(); 86 79 }; 87 like( $@, qr/ is valid object key/, "bad object key" );80 like( $@, qr/1 was expected/, "no params" ); 88 81 89 82 Test::Nebulous->setup; … … 93 86 proxy => "http://$hostport/nebulous", 94 87 ); 95 my $uri = $neb->delete_instance("foo");88 $neb->delete_instance( "foo", 2 ); 96 89 }; 97 like( $@, qr/2 were expected/, "missing second param" ); 98 99 Test::Nebulous->setup; 100 101 eval { 102 my $neb = Nebulous::Client->new( 103 proxy => "http://$hostport/nebulous", 104 ); 105 $neb->delete_instance(); 106 }; 107 like( $@, qr/2 were expected/, "no params" ); 108 109 Test::Nebulous->setup; 110 111 eval { 112 my $neb = Nebulous::Client->new( 113 proxy => "http://$hostport/nebulous", 114 ); 115 $neb->delete_instance("foo", 2, 3); 116 }; 117 like( $@, qr/2 were expected/, "too many params" ); 90 like( $@, qr/1 was expected/, "too many params" ); 118 91 119 92 Test::Nebulous->cleanup;
Note:
See TracChangeset
for help on using the changeset viewer.
