code: function downloadSingleBatchSet(done) {
      // Fetch the doc IDs for the batches in the current set to
      // download them.
      function batchSetComplete(err, data) {
        total = data.total;
        done();
      }
      function processRetrievedBatches(err, batches) {
        // process them in parallelised queue
        processBatchSet(db, parallelism, log, batches, ee, startTime, total, batchSetComplete);
      }
  
      readBatchSetIdsFromLogFile(log, batchesPerDownloadSession, function(err, batchSetIds) {
        if (err) {
          ee.emit('error', err);
          // Stop processing changes file for fatal errors
          noRemainingBatches = true;
          done();
        } else {
          if (batchSetIds.length === 0) {
            noRemainingBatches = true;
            return done();
          }
          logfilegetbatches(log, batchSetIds, processRetrievedBatches);
        }
      });
    }
docs: Generate a set of batches (up to batchesPerDownloadSession) to download from the log file and download them. Set noRemainingBatches to `true` for last batch.