Changeset 6098
- Timestamp:
- Jan 20, 2006, 4:39:05 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/PS-IPP-MetaDB/lib/PS/IPP/MetaDB.pm (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/PS-IPP-MetaDB/lib/PS/IPP/MetaDB.pm
r5339 r6098 1 1 # Copyright (C) 2005 Joshua Hoblitt 2 2 # 3 # $Id: MetaDB.pm,v 1.1 3 2005-10-15 00:09:37jhoblitt Exp $3 # $Id: MetaDB.pm,v 1.14 2006-01-21 02:39:05 jhoblitt Exp $ 4 4 5 5 package PS::IPP::MetaDB; … … 60 60 } 61 61 62 sub add_ new{62 sub add_fetch { 63 63 my $class = shift; 64 64 my %p = @_; 65 65 66 PS::IPP::MetaDB::Image:: New->create({66 PS::IPP::MetaDB::Image::Fetch->create({ 67 67 exp_id => $p{exp_id}, 68 68 class => $p{class}, … … 77 77 } 78 78 79 sub new_fields79 sub fetch_fields 80 80 { 81 return PS::IPP::MetaDB::Image:: New->fields;82 } 83 84 sub find_ new{81 return PS::IPP::MetaDB::Image::Raw->fields; 82 } 83 84 sub find_fetch { 85 85 my $class = shift; 86 86 my %p = @_; … … 88 88 my @rows; 89 89 if (exists $p{exp_id}) { 90 @rows = PS::IPP::MetaDB::Image:: New->search(90 @rows = PS::IPP::MetaDB::Image::Fetch ->search( 91 91 exp_id => $p{exp_id}, 92 92 { order_by => 'class_id' }, 93 93 ); 94 94 } else { 95 @rows = PS::IPP::MetaDB::Image:: New->retrieve_all;95 @rows = PS::IPP::MetaDB::Image::Fetch->retrieve_all; 96 96 } 97 97 98 my @fields = new_fields();98 my @fields = fetch_fields(); 99 99 my @result; 100 100 foreach my $obj (@rows) { … … 107 107 } 108 108 109 sub new2newed{109 sub fetch2raw { 110 110 my $class = shift; 111 111 my %p = @_; 112 112 113 $class->do_transaction(sub { $class->_ new2newed(%p) });114 } 115 116 sub _ new2newed{113 $class->do_transaction(sub { $class->_fetch2raw(%p) }); 114 } 115 116 sub _fetch2raw { 117 117 my $class = shift; 118 118 my %p = @_; 119 119 120 my $ new = PS::IPP::MetaDB::Image::New->search(120 my $fetch = PS::IPP::MetaDB::Image::fetch->search( 121 121 exp_id => $p{exp_id}, 122 122 class => $p{class}, … … 125 125 126 126 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, 135 135 # 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, 139 139 # new storage url 140 140 url => $p{url}, 141 141 }); 142 142 143 $ new->delete;143 $fetch->delete; 144 144 } 145 145 … … 159 159 =over 4 160 160 161 =item * image_ new161 =item * image_fetch 162 162 163 163 This 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.164 summit. The location of fetched data files is written into the C<raw> table. 165 165 166 166 Table description: … … 208 208 =cut 209 209 210 package PS::IPP::MetaDB::Image:: New;210 package PS::IPP::MetaDB::Image::Fetch; 211 211 212 212 use base qw( PS::IPP::MetaDB ); … … 216 216 sub init 217 217 { 218 __PACKAGE__->table("image_ new");218 __PACKAGE__->table("image_fetch"); 219 219 __PACKAGE__->create_table(q{ 220 220 exp_id BIGINT NOT NULL PRIMARY KEY, … … 238 238 =item * notify_received 239 239 240 XXX no longer needed? 241 240 242 This is a queue of pending file received notifications that need to be send to 241 243 OTIS. Once a notification is successfully sent to OTIS the entry is removed … … 267 269 } 268 270 269 =item * metadata_ new271 =item * metadata_fetch 270 272 271 273 This table contains a list of new metadata waiting to be downloaded from the … … 300 302 =cut 301 303 302 package PS::IPP::MetaDB::Metadata:: New;304 package PS::IPP::MetaDB::Metadata::Fetch; 303 305 304 306 use base qw( PS::IPP::MetaDB ); … … 308 310 sub init 309 311 { 310 __PACKAGE__->table("metadata_ new");312 __PACKAGE__->table("metadata_fetch"); 311 313 __PACKAGE__->create_table(q{ 312 314 stamp DATETIME, … … 319 321 } 320 322 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 325 Phase 1: A list of exposure IDs to extra metadata from. 326 327 =over 4 328 329 =item * exp_id 330 331 exposure ID #, keyed against the C<raw> table. 332 333 =back 334 335 =cut 336 337 package PS::IPP::MetaDB::Exposure::Prepare; 338 339 use base qw( PS::IPP::MetaDB ); 340 341 __PACKAGE__->register_init(\&init); 342 343 sub 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 354 Phase 2: A list of exposure components to reduce. 355 356 =over 4 357 358 =item * exp_id 359 360 exposure ID #, keyed against the C<prepared> table. 330 361 331 362 =item * class_id 332 363 333 Class ID #, keyed against the C<newed> table. 364 class ID #, keyed against the C<prepared> table. 365 366 =item * prepare_version 367 368 version #, keyed against the C<prepared> table. 369 370 =back 371 372 =item * exposure_mosaic 373 374 Phase 3: A list of exposures to process. 375 376 =over 4 377 378 =item * exp_id 379 380 exposure ID #, keyed against the C<reduced> table. 381 382 =item * exp_config 383 384 Class 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 400 These tables describe data in other tables. 401 402 =over 4 403 404 =item * exposure 405 406 A list of ALL exposure ID #s. 407 408 =over 4 409 410 =item * exp_id 411 412 exposure ID #. 413 414 =item * camera 415 416 Name of the camera the generated the exposure. 417 418 =item * type 419 420 The type of exposure taken. 421 422 =item * n_components 423 424 The number of file that make of the complete exposure. 425 426 =back 427 428 =item * exposure_component 429 430 A list of the files that together make up a complete exposure. 431 432 =over 4 433 434 =item * exp_id 435 436 exposure ID #, keyed against the C<exposure> table. 437 438 =item * class_id 439 440 class ID #. 441 442 =item * class 443 444 The type of component this is 445 446 =back 447 448 =item * exposure_config 449 450 This 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 457 exposure config ID #. 458 459 =item * class_id 460 461 class ID #, keyed against the C<exposure_component> table. 462 463 =item * version 464 465 version ID #, keyed against the C<exposure_component> table. 466 467 =item * n_components 468 469 =back 470 471 =item * exposure_reduced 472 473 A list of version ID #'s assigned after reducing data. This table is used to 474 make sure that all components of an exposure get the same version ID assigned 475 to them. 476 477 =over 4 478 479 =item * exp_id 480 481 exposure ID #, keyed on the C<exposure> table. 482 483 =item * reduced_version 484 485 Version ID # used. 486 487 =back 488 489 =back 490 491 =head2 File Storage 492 493 These tables describe data actually stored on disk. 494 495 =over 4 496 497 =item * raw 498 499 Note that there is only one 'version' of the original data. 500 501 =over 4 502 503 =item * exp_id 504 505 exposure ID #, keyed on the C<exposure_component> table. 506 507 =item * class 508 509 The 'type' of data this is. 510 511 =item * class_id 512 513 class ID #, keyed on the C<exposure_componet> table. 514 515 =item * url 516 517 url to the storage location of the file. 334 518 335 519 =back … … 346 530 { 347 531 __PACKAGE__->table("raw"); 348 __PACKAGE__->create_table(q{349 exp_id BIGINT NOT NULL PRIMARY KEY,350 class_id BIGINT NOT NULL351 });352 __PACKAGE__->set_up_table;353 }354 355 =item * prepare356 357 Phase 1: A list of exposure IDs to extra metadata from.358 359 =over 4360 361 =item * exp_id362 363 exposure ID #, keyed against the C<newed> table.364 365 =item * exp_config366 367 Class ID #, keyed against the C<exposure_config> table.368 369 =back370 371 =item * reduce372 373 Phase 2: A list of exposure components to reduce.374 375 =over 4376 377 =item * exp_id378 379 exposure ID #, keyed against the C<prepared> table.380 381 =item * class_id382 383 class ID #, keyed against the C<prepared> table.384 385 =item * prepared_ver386 387 version #, keyed against the C<prepared> table.388 389 =item * dest_ver390 391 version # to be written into the C<reduced> table.392 393 =back394 395 =item * mosaic396 397 Phase 3: A list of exposures to process.398 399 =over 4400 401 =item * exp_id402 403 exposure ID #, keyed against the C<reduced> table.404 405 =item * exp_config406 407 Class ID #, keyed against the C<exposure_config> table.408 409 =back410 411 =item * combine412 413 =over 4414 415 =item * run_id???416 417 =back418 419 =back420 421 =head2 Metadata422 423 These tables describe data in other tables.424 425 =over 4426 427 =item * exposure428 429 A list of ALL exposure ID #s.430 431 =over 4432 433 =item * exp_id434 435 exposure ID #.436 437 =item * camera438 439 Name of the camera the generated the exposure.440 441 =item * type442 443 The type of exposure taken.444 445 =item * n_components446 447 The number of file that make of the complete exposure.448 449 =back450 451 =item * exposure_component452 453 A list of the files that together make up a complete exposure.454 455 =over 4456 457 =item * exp_id458 459 exposure ID #, keyed against the C<exposure> table.460 461 =item * class_id462 463 class ID #.464 465 =item * class466 467 The type of component this is468 469 =back470 471 =item * exposure_config472 473 This table provides a way to configure which 'version' of components of an474 'exposure' to use.475 476 =over 4477 478 =item * exp_config479 480 exposure config ID #.481 482 =item * class_id483 484 class ID #, keyed against the C<exposure_component> table.485 486 =item * version487 488 version ID #, keyed against the C<exposure_component> table.489 490 =item * n_components491 492 =back493 494 =item * exposure_reduced495 496 A list of version ID #'s assigned after reducing data. This table is used to497 make sure that all components of an exposure get the same version ID assigned498 to them.499 500 =over 4501 502 =item * exp_id503 504 exposure ID #, keyed on the C<exposure> table.505 506 =item * reduced_version507 508 Version ID # used.509 510 =back511 512 =back513 514 =head2 File Storage515 516 These tables describe data actually stored on disk.517 518 =over 4519 520 =item * newed521 522 Note that there is only one 'version' of the original data.523 524 =over 4525 526 =item * exp_id527 528 exposure ID #, keyed on the C<exposure_component> table.529 530 =item * class531 532 The 'type' of data this is.533 534 =item * class_id535 536 class ID #, keyed on the C<exposure_componet> table.537 538 =item * url539 540 url to the storage location of the file.541 542 =back543 544 =cut545 546 package PS::IPP::MetaDB::Image::Newed;547 548 use base qw( PS::IPP::MetaDB );549 550 __PACKAGE__->register_init(\&init);551 552 sub init553 {554 __PACKAGE__->table("newed");555 532 __PACKAGE__->create_table(q{ 556 533 exp_id BIGINT NOT NULL PRIMARY KEY, … … 582 559 class ID #, keyed on the C<exposure_componet> table. 583 560 584 =item * version 585 586 version ID # 587 588 =item * recipe 589 590 algorithm ID # 561 =item * prepare_version 562 563 prepare step version ID # 564 591 565 592 566 =item * url … … 610 584 class ID #, keyed on the C<exposure_componet> table. 611 585 612 =item * version613 614 version ID #615 616 =item * re cipe617 618 algorithmID #586 =item * prepare_version 587 588 prepare step version ID # 589 590 =item * reduce_version 591 592 reduce step version ID # 619 593 620 594 =item * url
Note:
See TracChangeset
for help on using the changeset viewer.
