src/ydn/db/core/operator.js
function(i, opt_key) {
      if (done) {
        if (ydn.db.core.DbOperator.DEBUG) {
          goog.global.console.log('iterator ' + i + ' done');
        }
        // calling next to a terminated iterator
        throw new ydn.error.InternalError();
      }
      result_count++;
      var is_result_ready = result_count === total;
      var idx = idx2iterator[i];
      /**
       * @type {!ydn.db.Iterator}
       */
      var iterator = iterators[idx];
      /**
       * @type {!ydn.db.core.req.ICursor}
       */
      var cursor = cursors[idx];
      var primary_key = cursor.getPrimaryKey();
      var value = cursor.getValue();
      if (ydn.db.core.DbOperator.DEBUG) {
        var key_str = opt_key +
            (goog.isDefAndNotNull(primary_key) ? ', ' + primary_key : '');
        var ready_str = is_result_ready ? ' (all result done)' : '';
        goog.global.console.log(cursor + ' new position ' + key_str + ready_str);
      }

      keys[i] = opt_key;
      if (iterator.isIndexIterator()) {
        if (iterator.isKeyIterator()) {
          values[i] = primary_key;
        } else {
          values[i] = value;
        }
      } else {
        if (iterator.isKeyIterator()) {
          values[i] = opt_key;
        } else {
          values[i] = value;
        }
      }

      if (is_result_ready) { // receive all results
        on_result_ready();
      }

    }
function(i, opt_key) {
      if (done) {
        if (ydn.db.core.DbOperator.DEBUG) {
          goog.global.console.log('iterator ' + i + ' done');
        }
        // calling next to a terminated iterator
        throw new ydn.error.InternalError();
      }
      result_count++;
      var is_result_ready = result_count === total;
      var idx = idx2iterator[i];
      /**
       * @type {!ydn.db.Iterator}
       */
      var iterator = iterators[idx];
      /**
       * @type {!ydn.db.core.req.ICursor}
       */
      var cursor = cursors[idx];
      var primary_key = cursor.getPrimaryKey();
      var value = cursor.getValue();
      if (ydn.db.core.DbOperator.DEBUG) {
        var key_str = opt_key +
            (goog.isDefAndNotNull(primary_key) ? ', ' + primary_key : '');
        var ready_str = is_result_ready ? ' (all result done)' : '';
        goog.global.console.log(cursor + ' new position ' + key_str + ready_str);
      }

      keys[i] = opt_key;
      if (iterator.isIndexIterator()) {
        if (iterator.isKeyIterator()) {
          values[i] = primary_key;
        } else {
          values[i] = value;
        }
      } else {
        if (iterator.isKeyIterator()) {
          values[i] = opt_key;
        } else {
          values[i] = value;
        }
      }

      if (is_result_ready) { // receive all results
        on_result_ready();
      }

    }
function ( i , opt_key ) { if ( done ) { if ( ydn . db . core . DbOperator . DEBUG ) { goog . global . console . log ( 'iterator ' + i + ' done' ) ; } // calling next to a terminated iterator throw new ydn . error . InternalError ( ) ; } result_count ++ ; var is_result_ready = result_count === total ; var idx = idx2iterator [ i ] ; /**
       * @type {!ydn.db.Iterator}
       */ var iterator = iterators [ idx ] ; /**
       * @type {!ydn.db.core.req.ICursor}
       */ var cursor = cursors [ idx ] ; var primary_key = cursor . getPrimaryKey ( ) ; var value = cursor . getValue ( ) ; if ( ydn . db . core . DbOperator . DEBUG ) { var key_str = opt_key + ( goog . isDefAndNotNull ( primary_key ) ? ', ' + primary_key : '' ) ; var ready_str = is_result_ready ? ' (all result done)' : '' ; goog . global . console . log ( cursor + ' new position ' + key_str + ready_str ) ; } keys [ i ] = opt_key ; if ( iterator . isIndexIterator ( ) ) { if ( iterator . isKeyIterator ( ) ) { values [ i ] = primary_key ; } else { values [ i ] = value ; } } else { if ( iterator . isKeyIterator ( ) ) { values [ i ] = opt_key ; } else { values [ i ] = value ; } } if ( is_result_ready ) { // receive all results on_result_ready ( ) ; } }
Received iterator result. When all iterators result are collected,
begin to send request to collect streamers results.
@param {number} i index.
@param {IDBKey=} opt_key effective key.
Received iterator result . When all iterators result are collected begin to send request to collect streamers results .