IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 7, 2009, 11:26:01 AM (17 years ago)
Author:
bills
Message:

Changes to receive processing. pass md5sum and filesize to dsget for checking
increase timeouts for receive.file.run

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/receivetool.c

    r24042 r24109  
    238238        psFree(output);
    239239
    240         if (!receiveFilesetInsert(config->dbh, 0, source_id, fileset, "new", NULL, 0)) {
     240        if (!receiveFilesetInsert(config->dbh, 0, source_id, fileset, "reg", NULL, 0)) {
    241241            psError(PS_ERR_UNKNOWN, false, "Unable to add fileset");
    242242            psFree(source_id_str);
     
    352352    // required
    353353    PXOPT_LOOKUP_S64(fileset_id, config->args, "-fileset_id", true, false);
    354     psMetadataItem *files = psMetadataLookup(config->args, "-file");
     354    PXOPT_LOOKUP_STR(file_list, config->args, "-file_list", true, false);
     355
     356    unsigned int numBad;
     357    psMetadata *files = psMetadataConfigRead(NULL, &numBad, file_list, false);
    355358    if (!files) {
    356         psError(PS_ERR_UNKNOWN, true, "-file is required");
    357         return false;
    358     }
     359        psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to cleanly read MDC file with file list.");
     360        return false;
     361    }
     362
    359363
    360364    if (!psDBTransaction(config->dbh)) {
     
    363367    }
    364368
    365     psListIterator *iter = psListIteratorAlloc(files->data.list, PS_LIST_HEAD, false); // Iterator
    366     psMetadataItem *item = NULL;        // Item from iteration
    367     while ((item = psListGetAndIncrement(iter))) {
    368         psAssert(item && item->data.V && item->type == PS_DATA_STRING, "Argument is bad");
    369 
    370         if (!receiveFileInsert(config->dbh, 0, fileset_id, item->data.str)) {
     369    psMetadataIterator *iter = psMetadataIteratorAlloc(files, PS_LIST_HEAD, NULL); // Iterator
     370    psMetadataItem *item;
     371    while ((item = psMetadataGetAndIncrement(iter))) {
     372        psMetadata *md = item->data.md;
     373        psString file = psMetadataLookupStr(NULL, md, "file");
     374        psS64    bytes = psMetadataLookupS64(NULL, md, "bytes");
     375        psString md5sum = psMetadataLookupStr(NULL, md, "md5sum");
     376        psString file_type = psMetadataLookupStr(NULL, md, "file_type");
     377        psString component = psMetadataLookupStr(NULL, md, "component");
     378       
     379        if (!file) {
     380            psError(PS_ERR_UNKNOWN, false, "failed to find value for file");
     381            return false;
     382        }
     383        if (!component) {
     384            psError(PS_ERR_UNKNOWN, false, "failed to find value for component");
     385            return false;
     386        }
     387
     388        if (!receiveFileInsert(config->dbh, 0, fileset_id, file, bytes, md5sum, file_type, component)) {
    371389            psError(PS_ERR_UNKNOWN, false, "Unable to add file");
    372             if (!psDBTransaction(config->dbh)) {
     390            if (!psDBRollback(config->dbh)) {
    373391                psError(PS_ERR_UNKNOWN, false, "Database error");
    374392                return false;
     
    378396        }
    379397    }
     398
    380399    psFree(iter);
    381400
Note: See TracChangeset for help on using the changeset viewer.