lib/utils/job-utils/catalog-searcher.js
function getDriveIdCatalog(nodeId, filter) {
        return waterline.catalogs.findMostRecent({
            node: nodeId,
            source: 'driveId'
        }).then(function (catalog) {
            if (!catalog || !_.has(catalog, 'data[0]')) {
                return Promise.reject(
                    new Error('Could not find driveId catalog data.'));
            }
            return catalog.data;
        }).filter(function (driveId) {
            if (_.isEmpty(filter)) {
                return true;
            }
            return _.indexOf(filter, driveId.identifier) > -1 ||
                _.indexOf(filter, driveId.devName) > -1;
        });
    }
function getDriveIdCatalog(nodeId, filter) {
        return waterline.catalogs.findMostRecent({
            node: nodeId,
            source: 'driveId'
        }).then(function (catalog) {
            if (!catalog || !_.has(catalog, 'data[0]')) {
                return Promise.reject(
                    new Error('Could not find driveId catalog data.'));
            }
            return catalog.data;
        }).filter(function (driveId) {
            if (_.isEmpty(filter)) {
                return true;
            }
            return _.indexOf(filter, driveId.identifier) > -1 ||
                _.indexOf(filter, driveId.devName) > -1;
        });
    }
function getDriveIdCatalog ( nodeId , filter ) { return waterline . catalogs . findMostRecent ( { node : nodeId , source : 'driveId' } ) . then ( function ( catalog ) { if ( ! catalog || ! _ . has ( catalog , 'data[0]' ) ) { return Promise . reject ( new Error ( 'Could not find driveId catalog data.' ) ) ; } return catalog . data ; } ) . filter ( function ( driveId ) { if ( _ . isEmpty ( filter ) ) { return true ; } return _ . indexOf ( filter , driveId . identifier ) > - 1 || _ . indexOf ( filter , driveId . devName ) > - 1 ; } ) ; }
Get driveId catalog data
@param {String} nodeId - node identifier
@param {Object} filter - [optional] The filter which contains the driveId catalogs identifier
Or devName. For example: ['sda', 'sdb', '1'].
driveId catalogs in filter will return, otherwise skip.
@return {Promise} driveId catalogs
Get driveId catalog data