Changeset 13047
- Timestamp:
- Apr 26, 2007, 1:47:05 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
-
Nebulous-Server/Changes (modified) (1 diff)
-
Nebulous-Server/MANIFEST (modified) (1 diff)
-
Nebulous-Server/lib/Nebulous/Server.pm (modified) (5 diffs)
-
Nebulous-Server/lib/Nebulous/Server/SQL.pm (modified) (5 diffs)
-
Nebulous-Server/t/12_server_find_objects.t (added)
-
Nebulous/Changes (modified) (1 diff)
-
Nebulous/MANIFEST (modified) (1 diff)
-
Nebulous/lib/Nebulous/Server.pm (modified) (5 diffs)
-
Nebulous/lib/Nebulous/Server/SQL.pm (modified) (5 diffs)
-
Nebulous/nebclient/nebulous.wsdl (modified) (3 diffs)
-
Nebulous/t/12_server_find_objects.t (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/Changes
r13046 r13047 2 2 3 3 0.05 4 - add Nebulous::Server->find_keys() 4 5 - add neb-touch 5 6 - add neb-df -
trunk/Nebulous-Server/MANIFEST
r13046 r13047 84 84 t/10_server_is_valid_volume_name.t 85 85 t/11_server_is_valid_class_id.t 86 t/12_server_find_objects.t 86 87 t/50_client_new.t 87 88 t/51_client_create.t -
trunk/Nebulous-Server/lib/Nebulous/Server.pm
r12966 r13047 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Server.pm,v 1.2 4 2007-04-23 23:31:32jhoblitt Exp $3 # $Id: Server.pm,v 1.25 2007-04-26 23:45:03 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server; … … 567 567 568 568 569 sub find_objects { 570 my $self = shift; 571 572 my ( $pattern ) = validate_pos( @_, 573 { 574 type => SCALAR, 575 optional => 1, 576 }, 577 ); 578 579 my $log = $self->log; 580 my $sql = $self->sql; 581 my $db =$self->db; 582 583 $log->debug( "entered - @_" ); 584 585 my $query; 586 587 eval { 588 $query = $db->prepare_cached( $sql->find_objects ); 589 $query->execute( $pattern ); 590 }; 591 $log->logdie( "database error: $@" ) if $@; 592 593 my @keys; 594 595 while ( my $row = $query->fetchrow_hashref ) { 596 my $key = $row->{ 'ext_id' }; 597 push @keys, $key if $key; 598 } 599 600 $log->debug( "no keys found" ) unless ( scalar @keys ); 601 602 $log->debug( "leaving" ); 603 604 return \@keys; 605 } 606 607 569 608 sub find_instances { 570 609 my $self = shift; … … 744 783 my $query; 745 784 eval { 785 # ask the db to generate the table of mounted Nebulous volume 786 $query = $db->prepare_cached("call getmountedvol()"); 787 $query->execute(); 788 746 789 # TODO cache this? 747 790 my $rows; … … 759 802 } 760 803 761 $volume = $query->fetchrow_hashref->{ ' mountpoint' };804 $volume = $query->fetchrow_hashref->{ 'volume' }; 762 805 763 806 $query->finish; … … 769 812 $log->logdie( "database error: $@" ) if $@; 770 813 } 814 815 $log->logdie( "failed to find a suitable volume" ) unless defined $volume; 771 816 772 817 $log->debug( "leaving" ); -
trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
r13041 r13047 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: SQL.pm,v 1.2 6 2007-04-26 20:27:33 jhoblitt Exp $3 # $Id: SQL.pm,v 1.27 2007-04-26 23:45:03 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server::SQL; … … 116 116 get_storage_volume_byname => qq{ 117 117 SELECT 118 mountpoint,118 path as volume, 119 119 total - used as free 120 FROM volume 121 JOIN mount -- join limits us to currently mounted volumes 122 ON volume.path = mount.mountpoint 120 FROM mountedvol 123 121 WHERE 124 122 used / total < ? … … 129 127 get_storage_volume => qq{ 130 128 SELECT 131 mountpoint,129 path as volume, 132 130 total - used as free 133 FROM volume 134 JOIN mount -- join limits us to currently mounted volumes 135 ON volume.path = mount.mountpoint 131 FROM mountedvol 136 132 WHERE 137 133 used / total < ? … … 152 148 FROM volume 153 149 WHERE name = ? 150 }, 151 find_objects => qq{ 152 SELECT * 153 FROM storage_object 154 WHERE ext_id REGEXP ? 154 155 }, 155 156 ); … … 315 316 ) ENGINE=MEMORY; 316 317 317 -- iterat orover the volume table finding the coresponding entry in the318 -- iterate over the volume table finding the coresponding entry in the 318 319 -- mount table and inserting union of the volume & mount row into the 319 320 -- mountedvol table -
trunk/Nebulous/Changes
r13046 r13047 2 2 3 3 0.05 4 - add Nebulous::Server->find_keys() 4 5 - add neb-touch 5 6 - add neb-df -
trunk/Nebulous/MANIFEST
r13046 r13047 84 84 t/10_server_is_valid_volume_name.t 85 85 t/11_server_is_valid_class_id.t 86 t/12_server_find_objects.t 86 87 t/50_client_new.t 87 88 t/51_client_create.t -
trunk/Nebulous/lib/Nebulous/Server.pm
r12966 r13047 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Server.pm,v 1.2 4 2007-04-23 23:31:32jhoblitt Exp $3 # $Id: Server.pm,v 1.25 2007-04-26 23:45:03 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server; … … 567 567 568 568 569 sub find_objects { 570 my $self = shift; 571 572 my ( $pattern ) = validate_pos( @_, 573 { 574 type => SCALAR, 575 optional => 1, 576 }, 577 ); 578 579 my $log = $self->log; 580 my $sql = $self->sql; 581 my $db =$self->db; 582 583 $log->debug( "entered - @_" ); 584 585 my $query; 586 587 eval { 588 $query = $db->prepare_cached( $sql->find_objects ); 589 $query->execute( $pattern ); 590 }; 591 $log->logdie( "database error: $@" ) if $@; 592 593 my @keys; 594 595 while ( my $row = $query->fetchrow_hashref ) { 596 my $key = $row->{ 'ext_id' }; 597 push @keys, $key if $key; 598 } 599 600 $log->debug( "no keys found" ) unless ( scalar @keys ); 601 602 $log->debug( "leaving" ); 603 604 return \@keys; 605 } 606 607 569 608 sub find_instances { 570 609 my $self = shift; … … 744 783 my $query; 745 784 eval { 785 # ask the db to generate the table of mounted Nebulous volume 786 $query = $db->prepare_cached("call getmountedvol()"); 787 $query->execute(); 788 746 789 # TODO cache this? 747 790 my $rows; … … 759 802 } 760 803 761 $volume = $query->fetchrow_hashref->{ ' mountpoint' };804 $volume = $query->fetchrow_hashref->{ 'volume' }; 762 805 763 806 $query->finish; … … 769 812 $log->logdie( "database error: $@" ) if $@; 770 813 } 814 815 $log->logdie( "failed to find a suitable volume" ) unless defined $volume; 771 816 772 817 $log->debug( "leaving" ); -
trunk/Nebulous/lib/Nebulous/Server/SQL.pm
r13041 r13047 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: SQL.pm,v 1.2 6 2007-04-26 20:27:33 jhoblitt Exp $3 # $Id: SQL.pm,v 1.27 2007-04-26 23:45:03 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server::SQL; … … 116 116 get_storage_volume_byname => qq{ 117 117 SELECT 118 mountpoint,118 path as volume, 119 119 total - used as free 120 FROM volume 121 JOIN mount -- join limits us to currently mounted volumes 122 ON volume.path = mount.mountpoint 120 FROM mountedvol 123 121 WHERE 124 122 used / total < ? … … 129 127 get_storage_volume => qq{ 130 128 SELECT 131 mountpoint,129 path as volume, 132 130 total - used as free 133 FROM volume 134 JOIN mount -- join limits us to currently mounted volumes 135 ON volume.path = mount.mountpoint 131 FROM mountedvol 136 132 WHERE 137 133 used / total < ? … … 152 148 FROM volume 153 149 WHERE name = ? 150 }, 151 find_objects => qq{ 152 SELECT * 153 FROM storage_object 154 WHERE ext_id REGEXP ? 154 155 }, 155 156 ); … … 315 316 ) ENGINE=MEMORY; 316 317 317 -- iterat orover the volume table finding the coresponding entry in the318 -- iterate over the volume table finding the coresponding entry in the 318 319 -- mount table and inserting union of the volume & mount row into the 319 320 -- mountedvol table -
trunk/Nebulous/nebclient/nebulous.wsdl
r4645 r13047 60 60 </message> 61 61 62 <message name="find_ObjectsRequest"> 63 <part name="pattern" type="xsd:string" /> 64 </message> 65 <message name="find_ObjectsResponse"> 66 <!-- fixme --> 67 <part name="result" type="tns:ArrayOfString" /> 68 </message> 69 62 70 <message name="find_instancesRequest"> 63 71 <part name="key" type="xsd:string" /> … … 114 122 --> 115 123 </operation> 124 <operation name="find_objects"> 125 <input message="tns:find_objectsRequest" /> 126 <output message="tns:find_objectsResponse" /> 127 <!-- 128 <fault name="" message="" /> 129 --> 130 </operation> 116 131 <operation name="find_instances"> 117 132 <input message="tns:find_instancesRequest" /> … … 175 190 <operation name="unlock_object"> 176 191 <soap:operation soapAction="urn:Nebulous/Server/SOAP#unlock_object" /> 192 <input> 193 <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP" 194 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> 195 </input> 196 <output> 197 <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP" 198 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> 199 </output> 200 </operation> 201 <operation name="find_objects"> 202 <soap:operation soapAction="urn:Nebulous/Server/SOAP#find_objects" /> 177 203 <input> 178 204 <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP"
Note:
See TracChangeset
for help on using the changeset viewer.
