IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 30, 2007, 4:52:04 PM (19 years ago)
Author:
jhoblitt
Message:

remove $class_id & $comment params from Nebulous::Server->create() and Nebulous::Client->create*() and all supporting functions and tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/lib/Nebulous/Server.pm

    r13087 r13092  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: Server.pm,v 1.27 2007-05-01 02:00:07 jhoblitt Exp $
     3# $Id: Server.pm,v 1.28 2007-05-01 02:52:04 jhoblitt Exp $
    44
    55package Nebulous::Server;
     
    123123    my $self = shift;
    124124
    125     my ( $key, $class, $volume, $comment ) = validate_pos( @_,
    126         {
    127             type        => SCALAR,
    128         },
    129         {
    130             type        => SCALAR,
    131             callbacks   => {
    132                 'is + integer' => sub { $_[0] =~ /^\d+$/ },
    133                 # check that the class requested is valid
    134                 'is valid class id' => sub { $self->_is_valid_class_id( $_[0] ) },
    135             },
    136             default     => 0,
     125    my ($key, $volume) = validate_pos(@_,
     126        {
     127            type        => SCALAR,
    137128        },
    138129        {
     
    144135            optional    => 1,
    145136        },
    146         {
    147             type        => SCALAR,
    148             callbacks   => {
    149                 # check that the comment isn't too long
    150                 'comment length' => sub { length $_[0] < 256 },
    151             },
    152             optional    => 1,
    153         },
    154137    );
    155138
     
    185168            # create storage_object_attr
    186169            my $query = $db->prepare_cached( $sql->new_object_attr );
    187             $query->execute( $object_id, $class, $comment );
     170            $query->execute( $object_id );
    188171        }
    189172
     
    10701053}
    10711054
    1072 sub _is_valid_class_id {
    1073     my ($self, $class_id) = @_;
    1074 
    1075     my $log = $self->log;
    1076     my $sql = $self->sql;
    1077     my $db  = $self->db;
    1078 
    1079     my $class;
    1080     eval {
    1081         my $query = $db->prepare_cached( $sql->get_class_by_id );
    1082         $query->execute( $class_id );
    1083         ( $class ) = $query->fetchrow_array;
    1084 
    1085         $query->finish;
    1086     };
    1087     if ( $@ ) {
    1088         $db->rollback;
    1089         $log->logdie( "database error: $@" );
    1090     }
    1091 
    1092     return ( defined $class ) ? 1 : undef;
    1093 }
    1094 
    10951055sub _is_valid_volume_name  {
    10961056    my ($self, $vol_name) = @_;
Note: See TracChangeset for help on using the changeset viewer.