IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6098


Ignore:
Timestamp:
Jan 20, 2006, 4:39:05 PM (20 years ago)
Author:
jhoblitt
Message:

revised schema

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-MetaDB/lib/PS/IPP/MetaDB.pm

    r5339 r6098  
    11# Copyright (C) 2005  Joshua Hoblitt
    22#
    3 # $Id: MetaDB.pm,v 1.13 2005-10-15 00:09:37 jhoblitt Exp $
     3# $Id: MetaDB.pm,v 1.14 2006-01-21 02:39:05 jhoblitt Exp $
    44
    55package PS::IPP::MetaDB;
     
    6060}
    6161
    62 sub add_new {
     62sub add_fetch {
    6363    my $class = shift;
    6464    my %p = @_;
    6565
    66     PS::IPP::MetaDB::Image::New->create({
     66    PS::IPP::MetaDB::Image::Fetch->create({
    6767        exp_id      => $p{exp_id},
    6868        class       => $p{class},
     
    7777}
    7878
    79 sub new_fields
     79sub fetch_fields
    8080{
    81     return PS::IPP::MetaDB::Image::New->fields;
    82 }
    83 
    84 sub find_new {
     81    return PS::IPP::MetaDB::Image::Raw->fields;
     82}
     83
     84sub find_fetch {
    8585    my $class = shift;
    8686    my %p = @_;
     
    8888    my @rows;
    8989    if (exists $p{exp_id}) {
    90         @rows = PS::IPP::MetaDB::Image::New->search(
     90        @rows = PS::IPP::MetaDB::Image::Fetch ->search(
    9191            exp_id => $p{exp_id},
    9292            { order_by => 'class_id' },
    9393        );
    9494    } else {
    95         @rows = PS::IPP::MetaDB::Image::New->retrieve_all;
     95        @rows = PS::IPP::MetaDB::Image::Fetch->retrieve_all;
    9696    }
    9797
    98     my @fields = new_fields();
     98    my @fields = fetch_fields();
    9999    my @result;
    100100    foreach my $obj (@rows) {
     
    107107}
    108108
    109 sub new2newed {
     109sub fetch2raw {
    110110    my $class = shift;
    111111    my %p = @_;
    112112
    113     $class->do_transaction(sub { $class->_new2newed(%p) });
    114 }
    115 
    116 sub _new2newed {
     113    $class->do_transaction(sub { $class->_fetch2raw(%p) });
     114}
     115
     116sub _fetch2raw {
    117117    my $class = shift;
    118118    my %p = @_;
    119119
    120     my $new = PS::IPP::MetaDB::Image::New->search(
     120    my $fetch = PS::IPP::MetaDB::Image::fetch->search(
    121121        exp_id      => $p{exp_id},
    122122        class       => $p{class},
     
    125125
    126126    PS::IPP::MetaDB::Image::NotifyReceived->create({
    127         file_id => $new->file_id,
    128     });
    129 
    130     PS::IPP::MetaDB::Image::Newed->create({
    131         exp_id      => $new->exp_id,
    132         class       => $new->class,
    133         class_id    => $new->class_id,
    134         camera      => $new->camera,
     127        file_id => $fetch->file_id,
     128    });
     129
     130    PS::IPP::MetaDB::Image::Raw->create({
     131        exp_id      => $fetch->exp_id,
     132        class       => $fetch->class,
     133        class_id    => $fetch->class_id,
     134        camera      => $fetch->camera,
    135135        # stamp should auto-update
    136         file_id     => $new->file_id,
    137         size        => $new->size,
    138         md5         => $new->md5,
     136        file_id     => $fetch->file_id,
     137        size        => $fetch->size,
     138        md5         => $fetch->md5,
    139139        # new storage url
    140140        url         => $p{url},
    141141    });
    142142
    143     $new->delete;
     143    $fetch->delete;
    144144}
    145145
     
    159159=over 4
    160160
    161 =item * image_new
     161=item * image_fetch
    162162
    163163This table contains a list of new data waiting to be downloaded from the
    164 summit.  The location of fetched data files is written into the C<newed> table.
     164summit.  The location of fetched data files is written into the C<raw> table.
    165165
    166166Table description:
     
    208208=cut
    209209
    210 package PS::IPP::MetaDB::Image::New;
     210package PS::IPP::MetaDB::Image::Fetch;
    211211
    212212use base qw( PS::IPP::MetaDB );
     
    216216sub init
    217217{
    218     __PACKAGE__->table("image_new");
     218    __PACKAGE__->table("image_fetch");
    219219    __PACKAGE__->create_table(q{
    220220        exp_id      BIGINT          NOT NULL PRIMARY KEY,
     
    238238=item * notify_received
    239239
     240XXX no longer needed?
     241
    240242This is a queue of pending file received notifications that need to be send to
    241243OTIS.  Once a notification is successfully sent to OTIS the entry is removed
     
    267269}
    268270
    269 =item * metadata_new
     271=item * metadata_fetch
    270272
    271273This table contains a list of new metadata waiting to be downloaded from the
     
    300302=cut
    301303
    302 package PS::IPP::MetaDB::Metadata::New;
     304package PS::IPP::MetaDB::Metadata::Fetch;
    303305
    304306use base qw( PS::IPP::MetaDB );
     
    308310sub init
    309311{
    310     __PACKAGE__->table("metadata_new");
     312    __PACKAGE__->table("metadata_fetch");
    311313    __PACKAGE__->create_table(q{
    312314        stamp       DATETIME,
     
    319321}
    320322
    321 =item * raw
    322 
    323 Phase 0.  A list of exposure IDs to extract metadata from.
    324 
    325 =over 4
    326 
    327 =item * exp_id
    328 
    329 exposure ID #, keyed against the C<newed> table.
     323=item * exposure_prepare
     324
     325Phase 1: A list of exposure IDs to extra metadata from.
     326
     327=over 4
     328
     329=item * exp_id
     330
     331exposure ID #, keyed against the C<raw> table.
     332
     333=back
     334
     335=cut
     336
     337package PS::IPP::MetaDB::Exposure::Prepare;
     338
     339use base qw( PS::IPP::MetaDB );
     340
     341__PACKAGE__->register_init(\&init);
     342
     343sub init
     344{
     345    __PACKAGE__->table("exposure_prepare");
     346    __PACKAGE__->create_table(q{
     347        exp_id      BIGINT          NOT NULL PRIMARY KEY,
     348    });
     349    __PACKAGE__->set_up_table;
     350}
     351
     352=item * image_reduce
     353
     354Phase 2: A list of exposure components to reduce.
     355
     356=over 4
     357
     358=item * exp_id
     359
     360exposure ID #, keyed against the C<prepared> table.
    330361
    331362=item * class_id
    332363
    333 Class ID #, keyed against the C<newed> table.
     364class ID #, keyed against the C<prepared> table.
     365
     366=item * prepare_version
     367
     368version #, keyed against the C<prepared> table.
     369
     370=back
     371
     372=item * exposure_mosaic
     373
     374Phase 3: A list of exposures to process.
     375
     376=over 4
     377
     378=item * exp_id
     379
     380exposure ID #, keyed against the C<reduced> table.
     381
     382=item * exp_config
     383
     384Class ID #, keyed against the C<exposure_config> table.
     385
     386=back
     387
     388=item * combine
     389
     390=over 4
     391
     392=item * run_id???
     393
     394=back
     395
     396=back
     397
     398=head2 Metadata
     399
     400These tables describe data in other tables.
     401
     402=over 4
     403
     404=item * exposure
     405
     406A list of ALL exposure ID #s.
     407
     408=over 4
     409
     410=item * exp_id
     411
     412exposure ID #.
     413
     414=item * camera
     415
     416Name of the camera the generated the exposure.
     417
     418=item * type
     419
     420The type of exposure taken.
     421
     422=item * n_components
     423
     424The number of file that make of the complete exposure.
     425
     426=back
     427
     428=item * exposure_component
     429
     430A list of the files that together make up a complete exposure.
     431
     432=over 4
     433
     434=item * exp_id
     435
     436exposure ID #, keyed against the C<exposure> table.
     437
     438=item * class_id
     439
     440class ID #.
     441
     442=item * class
     443
     444The type of component this is
     445
     446=back
     447
     448=item * exposure_config
     449
     450This table provides a way to configure which 'version' of components of an
     451'exposure' to use.
     452
     453=over 4
     454
     455=item * exp_config
     456
     457exposure config ID #.
     458
     459=item * class_id
     460
     461class ID #, keyed against the C<exposure_component> table.
     462
     463=item * version
     464
     465version ID #, keyed against the C<exposure_component> table.
     466
     467=item * n_components
     468
     469=back
     470
     471=item * exposure_reduced
     472
     473A list of version ID #'s assigned after reducing data.  This table is used to
     474make sure that all components of an exposure get the same version ID assigned
     475to them.
     476
     477=over 4
     478
     479=item * exp_id
     480
     481exposure ID #, keyed on the C<exposure> table.
     482
     483=item * reduced_version
     484
     485Version ID # used.
     486
     487=back
     488
     489=back
     490
     491=head2 File Storage
     492
     493These tables describe data actually stored on disk.
     494
     495=over 4
     496
     497=item * raw
     498
     499Note that there is only one 'version' of the original data.
     500
     501=over 4
     502
     503=item * exp_id
     504
     505exposure ID #, keyed on the C<exposure_component> table.
     506
     507=item * class
     508
     509The 'type' of data this is.
     510
     511=item * class_id
     512
     513class ID #, keyed on the C<exposure_componet> table.
     514
     515=item * url
     516
     517url to the storage location of the file.
    334518
    335519=back
     
    346530{
    347531    __PACKAGE__->table("raw");
    348     __PACKAGE__->create_table(q{
    349         exp_id      BIGINT          NOT NULL PRIMARY KEY,
    350         class_id    BIGINT          NOT NULL
    351     });
    352     __PACKAGE__->set_up_table;
    353 }
    354 
    355 =item * prepare
    356 
    357 Phase 1: A list of exposure IDs to extra metadata from.
    358 
    359 =over 4
    360 
    361 =item * exp_id
    362 
    363 exposure ID #, keyed against the C<newed> table.
    364 
    365 =item * exp_config
    366 
    367 Class ID #, keyed against the C<exposure_config> table.
    368 
    369 =back
    370 
    371 =item * reduce
    372 
    373 Phase 2: A list of exposure components to reduce.
    374 
    375 =over 4
    376 
    377 =item * exp_id
    378 
    379 exposure ID #, keyed against the C<prepared> table.
    380 
    381 =item * class_id
    382 
    383 class ID #, keyed against the C<prepared> table.
    384 
    385 =item * prepared_ver
    386 
    387 version #, keyed against the C<prepared> table.
    388 
    389 =item * dest_ver
    390 
    391 version # to be written into the C<reduced> table.
    392 
    393 =back
    394 
    395 =item * mosaic
    396 
    397 Phase 3: A list of exposures to process.
    398 
    399 =over 4
    400 
    401 =item * exp_id
    402 
    403 exposure ID #, keyed against the C<reduced> table.
    404 
    405 =item * exp_config
    406 
    407 Class ID #, keyed against the C<exposure_config> table.
    408 
    409 =back
    410 
    411 =item * combine
    412 
    413 =over 4
    414 
    415 =item * run_id???
    416 
    417 =back
    418 
    419 =back
    420 
    421 =head2 Metadata
    422 
    423 These tables describe data in other tables.
    424 
    425 =over 4
    426 
    427 =item * exposure
    428 
    429 A list of ALL exposure ID #s.
    430 
    431 =over 4
    432 
    433 =item * exp_id
    434 
    435 exposure ID #.
    436 
    437 =item * camera
    438 
    439 Name of the camera the generated the exposure.
    440 
    441 =item * type
    442 
    443 The type of exposure taken.
    444 
    445 =item * n_components
    446 
    447 The number of file that make of the complete exposure.
    448 
    449 =back
    450 
    451 =item * exposure_component
    452 
    453 A list of the files that together make up a complete exposure.
    454 
    455 =over 4
    456 
    457 =item * exp_id
    458 
    459 exposure ID #, keyed against the C<exposure> table.
    460 
    461 =item * class_id
    462 
    463 class ID #.
    464 
    465 =item * class
    466 
    467 The type of component this is
    468 
    469 =back
    470 
    471 =item * exposure_config
    472 
    473 This table provides a way to configure which 'version' of components of an
    474 'exposure' to use.
    475 
    476 =over 4
    477 
    478 =item * exp_config
    479 
    480 exposure config ID #.
    481 
    482 =item * class_id
    483 
    484 class ID #, keyed against the C<exposure_component> table.
    485 
    486 =item * version
    487 
    488 version ID #, keyed against the C<exposure_component> table.
    489 
    490 =item * n_components
    491 
    492 =back
    493 
    494 =item * exposure_reduced
    495 
    496 A list of version ID #'s assigned after reducing data.  This table is used to
    497 make sure that all components of an exposure get the same version ID assigned
    498 to them.
    499 
    500 =over 4
    501 
    502 =item * exp_id
    503 
    504 exposure ID #, keyed on the C<exposure> table.
    505 
    506 =item * reduced_version
    507 
    508 Version ID # used.
    509 
    510 =back
    511 
    512 =back
    513 
    514 =head2 File Storage
    515 
    516 These tables describe data actually stored on disk.
    517 
    518 =over 4
    519 
    520 =item * newed
    521 
    522 Note that there is only one 'version' of the original data.
    523 
    524 =over 4
    525 
    526 =item * exp_id
    527 
    528 exposure ID #, keyed on the C<exposure_component> table.
    529 
    530 =item * class
    531 
    532 The 'type' of data this is.
    533 
    534 =item * class_id
    535 
    536 class ID #, keyed on the C<exposure_componet> table.
    537 
    538 =item * url
    539 
    540 url to the storage location of the file.
    541 
    542 =back
    543 
    544 =cut
    545 
    546 package PS::IPP::MetaDB::Image::Newed;
    547 
    548 use base qw( PS::IPP::MetaDB );
    549 
    550 __PACKAGE__->register_init(\&init);
    551 
    552 sub init
    553 {
    554     __PACKAGE__->table("newed");
    555532    __PACKAGE__->create_table(q{
    556533        exp_id      BIGINT          NOT NULL PRIMARY KEY,
     
    582559class ID #, keyed on the C<exposure_componet> table.
    583560
    584 =item * version
    585 
    586 version ID #
    587 
    588 =item * recipe
    589 
    590 algorithm ID #
     561=item * prepare_version
     562
     563prepare step version ID #
     564
    591565
    592566=item * url
     
    610584class ID #, keyed on the C<exposure_componet> table.
    611585
    612 =item * version
    613 
    614 version ID #
    615 
    616 =item * recipe
    617 
    618 algorithm ID #
     586=item * prepare_version
     587
     588prepare step version ID #
     589
     590=item * reduce_version
     591
     592reduce step version ID #
    619593
    620594=item * url
Note: See TracChangeset for help on using the changeset viewer.