Changeset 20987
- Timestamp:
- Dec 14, 2008, 12:19:16 PM (17 years ago)
- Location:
- branches/neb_single_20081210/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
-
branches/neb_single_20081210/Nebulous/lib/Nebulous/Client.pm
r20094 r20987 1 1 # Copyright (c) 2004-2008 Joshua Hoblitt 2 2 # 3 # $Id: Client.pm,v 1.62 2008-10-13 21:20:33 jhoblittExp $3 # $Id: Client.pm,v 1.62.8.1 2008-12-14 22:19:16 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( "$uri")) {245 unless ($self->delete_instance($key, "$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( "$uri");258 $self->delete_instance($key, "$uri"); 259 259 $log->logdie( "md5sum mismatch" ); 260 260 } … … 327 327 } 328 328 329 my $uri = $self->delete_instance( @$locations[0]);329 my $uri = $self->delete_instance($key, @$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( $uri) or return undef;815 $self->delete_instance($key, $uri) or return undef; 816 816 } 817 817 … … 944 944 my $self = shift; 945 945 946 my ($uri) = validate_pos(@_, 946 my ($key, $uri) = validate_pos(@_, 947 { 948 type => SCALAR, 949 }, 947 950 { 948 951 type => SCALAR, … … 961 964 $log->logdie( $@ ) if $@; 962 965 963 my $response = $self->{ 'server' }->delete_instance( $uri);966 my $response = $self->{ 'server' }->delete_instance($key, $uri); 964 967 if ( $response->fault ) { 965 968 $self->set_err($response->faultstring); -
branches/neb_single_20081210/Nebulous/nebclient/nebulous.wsdl
r20901 r20987 125 125 126 126 <message name="delete_instanceRequest"> 127 <part name="key" type="xsd:string" /> 127 128 <part name="uri" type="xsd:string" /> 128 129 </message> -
branches/neb_single_20081210/Nebulous/nebclient/src/nebclient.c
r20344 r20987 4 4 * Copyright (C) 2005 Joshua Hoblitt 5 5 * 6 * $Id: nebclient.c,v 1.54 2008-10-23 22:30:44 billsExp $6 * $Id: nebclient.c,v 1.54.8.1 2008-12-14 22:19:16 eugene Exp $ 7 7 */ 8 8 … … 253 253 } 254 254 255 if (!nebDeleteInstance(server, locations->URI[0])) {255 if (!nebDeleteInstance(server, key, 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, locations->URI[i])) {541 if (!nebDeleteInstance(server, key, 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 * URI)657 bool nebDeleteInstance(nebServer *server, const char *key, 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 *) URI, &response) != SOAP_OK) {678 NULL, (char *)key, (char *)URI, &response) != SOAP_OK) { 679 679 nebFree(filename); 680 680 -
branches/neb_single_20081210/Nebulous/nebclient/src/nebclient.h
r20344 r20987 4 4 * Copyright (C) 2005 Joshua Hoblitt 5 5 * 6 * $Id: nebclient.h,v 1.36 2008-10-23 22:30:44 billsExp $6 * $Id: nebclient.h,v 1.36.8.1 2008-12-14 22:19:16 eugene Exp $ 7 7 */ 8 8 … … 248 248 bool nebDeleteInstance( 249 249 nebServer *server, ///< nebServer object 250 const char *key, ///< storage object key (name) 250 251 const char *URI ///< URL of instance to remove 251 252 ); -
branches/neb_single_20081210/Nebulous/nebclient/src/nebulous.h
r20208 r20987 1 1 /* src/nebulous.h 2 2 Generated by wsdl2h 1.2.11 from nebulous.wsdl and typemap.dat 3 2008-1 0-16 23:26:37GMT3 2008-12-11 21:42:13 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, 810 811 char* uri, 811 812 // response parameters: … … 819 820 struct soap *soap, 820 821 // request parameters: 822 char* key, 821 823 char* uri, 822 824 // response parameters: … … 831 833 //gsoap ns1 service method-action: delete_USCOREinstance urn:Nebulous/Server/SOAP#delete_instance 832 834 int ns1__delete_USCOREinstance( 835 char* key, ///< Request parameter 833 836 char* uri, ///< Request parameter 834 837 int *result ///< Response parameter -
branches/neb_single_20081210/Nebulous/nebclient/src/soapC.c
r20208 r20987 12 12 #endif 13 13 14 SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.11 2008-1 0-16 23:26:39GMT")14 SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.11 2008-12-11 21:42:14 GMT") 15 15 16 16 … … 1342 1342 { 1343 1343 (void)soap; (void)a; /* appease -Wall -Werror */ 1344 soap_default_string(soap, &a->key); 1344 1345 soap_default_string(soap, &a->uri); 1345 1346 } … … 1348 1349 { 1349 1350 (void)soap; (void)a; /* appease -Wall -Werror */ 1351 soap_serialize_string(soap, &a->key); 1350 1352 soap_serialize_string(soap, &a->uri); 1351 1353 } … … 1363 1365 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__delete_USCOREinstance), type)) 1364 1366 return soap->error; 1367 if (soap_out_string(soap, "key", -1, &a->key, "")) 1368 return soap->error; 1365 1369 if (soap_out_string(soap, "uri", -1, &a->uri, "")) 1366 1370 return soap->error; … … 1378 1382 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) 1379 1383 { 1384 size_t soap_flag_key = 1; 1380 1385 size_t soap_flag_uri = 1; 1381 1386 if (soap_element_begin_in(soap, tag, 0, type)) … … 1389 1394 for (;;) 1390 1395 { 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 } 1391 1401 if (soap_flag_uri && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1392 1402 if (soap_in_string(soap, "uri", &a->uri, "xsd:string")) -
branches/neb_single_20081210/Nebulous/nebclient/src/soapClient.c
r20208 r20987 10 10 #endif 11 11 12 SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.11 2008-1 0-16 23:26:38GMT")12 SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.11 2008-12-11 21:42:13 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 * 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 *key, 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; 710 711 soap_tmp_ns1__delete_USCOREinstance.uri = uri; 711 712 soap_begin(soap); -
branches/neb_single_20081210/Nebulous/nebclient/src/soapServer.c
r20208 r20987 10 10 #endif 11 11 12 SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.11 2008-1 0-16 23:26:38GMT")12 SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.11 2008-12-11 21:42:13 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. 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); 646 646 if (soap->error) 647 647 return soap->error; -
branches/neb_single_20081210/Nebulous/nebclient/src/soapStub.h
r20208 r20987 283 283 struct ns1__delete_USCOREinstance 284 284 { 285 char *key; /* optional element of type xsd:string */ 285 286 char *uri; /* optional element of type xsd:string */ 286 287 }; … … 432 433 SOAP_FMAC5 int SOAP_FMAC6 ns1__find_USCOREinstances(struct soap*, char *key, char *volume, struct ns1__find_USCOREinstancesResponse *_param_3); 433 434 434 SOAP_FMAC5 int SOAP_FMAC6 ns1__delete_USCOREinstance(struct soap*, char * uri, int *result);435 SOAP_FMAC5 int SOAP_FMAC6 ns1__delete_USCOREinstance(struct soap*, char *key, char *uri, int *result); 435 436 436 437 SOAP_FMAC5 int SOAP_FMAC6 ns1__stat_USCOREobject(struct soap*, char *key, struct ns1__stat_USCOREobjectResponse *_param_4); … … 467 468 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); 468 469 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);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); 470 471 471 472 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); -
branches/neb_single_20081210/Nebulous/t/62_client_delete_instance.t
r5667 r20987 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 62_client_delete_instance.t,v 1.1 2005-12-03 02:52:31 jhoblittExp $5 # $Id: 62_client_delete_instance.t,v 1.1.40.1 2008-12-14 22:19:16 eugene Exp $ 6 6 7 7 use strict; … … 10 10 use Apache::Test qw( -withtestmore ); 11 11 12 plan tests => 9;12 plan tests => 11; 13 13 14 14 use lib qw( ./t ./lib ); … … 26 26 proxy => "http://$hostport/nebulous", 27 27 ); 28 $neb->create( "foo" );29 28 30 my $locations = $neb->find_instances( "foo" ); 29 my $key = "foo"; 30 $neb->create($key); 31 31 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]); 33 35 34 36 is( $uri, @$locations[0], "delete instance" ); … … 43 45 proxy => "http://$hostport/nebulous", 44 46 ); 45 $neb->create( "foo" ); 46 $neb->replicate( "foo" ); 47 my $key = "foo"; 48 $neb->create($key); 49 $neb->replicate($key); 47 50 48 51 my $uri1 = $neb->find_instances( "foo" )->[0]; 49 52 50 ok( $neb->delete_instance( $uri1), "delete instance" );53 ok( $neb->delete_instance($key, $uri1), "delete instance" ); 51 54 52 55 my $uri2 = $neb->find_instances( "foo" )->[0]; … … 54 57 isnt( $uri1, $uri2, "other instance remains" ); 55 58 56 ok( $neb->delete_instance( $uri2), "delete instance" );59 ok( $neb->delete_instance($key, $uri2), "delete instance" ); 57 60 58 61 my $locations = $neb->find_instances( "foo" ); 59 62 60 is( $locations, undef, "no rema ning instances" );63 is( $locations, undef, "no remaining instances" ); 61 64 } 65 66 Test::Nebulous->setup; 62 67 63 68 { … … 65 70 proxy => "http://$hostport/nebulous", 66 71 ); 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" ); 68 75 69 76 is( $uri, undef, "uri does not exist" ); … … 76 83 proxy => "http://$hostport/nebulous", 77 84 ); 78 $neb->delete_instance();85 my $uri = $neb->delete_instance("foo", "file:/foo" ); 79 86 }; 80 like( $@, qr/ 1 was expected/, "no params" );87 like( $@, qr/is valid object key/, "bad object key" ); 81 88 82 89 Test::Nebulous->setup; … … 86 93 proxy => "http://$hostport/nebulous", 87 94 ); 88 $neb->delete_instance( "foo", 2);95 my $uri = $neb->delete_instance("foo"); 89 96 }; 90 like( $@, qr/1 was expected/, "too many params" ); 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" ); 91 118 92 119 Test::Nebulous->cleanup;
Note:
See TracChangeset
for help on using the changeset viewer.
