/[cvs]/nfo/perl/libs/Data/Storage/Container.pm
ViewVC logotype

Diff of /nfo/perl/libs/Data/Storage/Container.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by joko, Sun Dec 1 07:08:35 2002 UTC revision 1.3 by joko, Sun Dec 1 22:18:28 2002 UTC
# Line 3  Line 3 
3  #  $Id$  #  $Id$
4  #  #
5  #  $Log$  #  $Log$
6    #  Revision 1.3  2002/12/01 22:18:28  joko
7    #  - no interactive implicit deploy
8    #  + only test integrity if storage available
9    #
10  #  Revision 1.2  2002/12/01 07:08:35  joko  #  Revision 1.2  2002/12/01 07:08:35  joko
11  #  + needs to "use Data::Storage;"  #  + needs to "use Data::Storage;"
12  #  #
# Line 133  sub initStorage { Line 137  sub initStorage {
137    
138    # should we test availability of the storage before using it?    # should we test availability of the storage before using it?
139    if ($locator->{test_availability}) {    if ($locator->{test_availability}) {
140        $locator->{status}->{availability} = $storage->testAvailability();
141      if ( !$storage->testAvailability() ) {      if ( !$storage->testAvailability() ) {
142        $logger->error( "$log_prefix is not available" );        $logger->error( "$log_prefix: testAvailability failed" );
       return;  
143      }      }
144    }    }
145                        
146    # should we test integrity of the storage before using it?    # should we test integrity of the storage before using it?
147    if ($locator->{test_integrity}) {    if ($locator->{status}->{availability} && $locator->{test_integrity}) {
148      #return unless $storage->testIntegrity();      #return unless $storage->testIntegrity();
149      $locator->{status}->{integrity} = $storage->testIntegrity();      $locator->{status}->{integrity} = $storage->testIntegrity();
150      # actions if integrity fails      # actions if integrity fails
151      if (!$locator->{status}->{integrity}) {      if (!$locator->{status}->{integrity}) {
152        $logger->error( "testIntegrity failed on $log_prefix" );        $logger->error( "$log_prefix: testIntegrity failed" );
       print "Try a $locator->{name}.deploySchema()? (y/n) ";  
       my $res = <STDIN>;  
       if ($res =~ m/y/i) {  
         $storage->deploySchema();  
       }  
153      }      }
154    }    }
155    
# Line 159  sub initStorage { Line 158  sub initStorage {
158    # don't connect right here, do an implicit connect on (later) usage    # don't connect right here, do an implicit connect on (later) usage
159    # maybe set ->{meta}->{connectmethod} = "connect" here    # maybe set ->{meta}->{connectmethod} = "connect" here
160    #return unless $storage->connect();    #return unless $storage->connect();
161    $storage->connect();    $storage->connect() if $locator->{status}->{integrity};
162    
163    # should we check emptyness?    # should we check emptyness?
164    if ( $locator->{test_emptyness} && $locator->{status}->{integrity} ) {    if ($locator->{status}->{availability} && $locator->{test_emptyness}) {
165        #print "test empty", "\n";
166      if ( !@{$storage->getChildNodes()} ) {      if ( !@{$storage->getChildNodes()} ) {
167        $locator->{status}->{empty} = 1;        $locator->{status}->{empty} = 1;
168        $logger->warning( "$log_prefix is empty");        $logger->warning( "$log_prefix: Storage is empty.");
169        #return;        #return;
170      }      }
171    }    }
172    
173    # expand logging?    # expand logging?
174    if ( $locator->{logger} && $locator->{status}->{integrity} ) {    if ( $locator->{status}->{integrity} && $locator->{logger} ) {
175      # expand logging (to Tangram-Database)      # expand logging (to Tangram-Database)
176      # TODO:      # TODO:
177      # - move configuration data from this code to db_config somehow      # - move configuration data from this code to db_config somehow
# Line 188  sub initStorage { Line 188  sub initStorage {
188    }    }
189    
190    #$self->{storage}->{$name} = $storage;    #$self->{storage}->{$name} = $storage;
191      #print "add storage: $name", "\n";
192    $self->addStorage($name, $storage);    $self->addStorage($name, $storage);
193    
194    return 1;    return 1;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed