How to use the asynciterator.BufferedIterator.call function in asynciterator

To help you get started, we’ve selected a few asynciterator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LinkedDataFragments / Client.js / lib / sparql / UnionIterator.js View on Github external
function UnionIterator(sources, options) {
  if (!(this instanceof UnionIterator))
    return new UnionIterator(sources, options);
  BufferedIterator.call(this, options);

  // Construct a list of readable sources
  this._sources = [];
  this._sourceIndex = 0;
  if (sources && sources.length) {
    // Create event listeners
    var self = this;
    function fillBuffer()     { self._fillBuffer(); }
    function emitError(error) { self.emit('error', error); }

    // Add all readable sources and listen to their events
    for (var i = 0, l = sources.length; i < l; i++) {
      var source = sources[i];
      if (source && !source.ended) {
        this._sources.push(source);
        source.on('readable', fillBuffer);
github LinkedDataFragments / Client.js / lib / triple-pattern-fragments / federated / FederatedFragmentsClient.js View on Github external
function CompoundFragment(fragments, options) {
  if (!(this instanceof CompoundFragment))
    return new CompoundFragment(fragments, options);
  BufferedIterator.call(this, options);

  // If no fragments are given, the fragment is empty
  if (!fragments || !fragments.length)
    return this.empty(), this;

  // Index fragments for processing and initialize metadata
  var fragmentsPending = fragments.length,
      metadataPending  = fragments.length,
      errorThreshold   = options.errorThreshold || 0,
      combinedMetadata = this._metadata = { totalTriples: 0 };
  fragments = this._fragments = _.indexBy(fragments, getIndex);

  // Combine all fragments into a single fragment
  var compoundFragment = this;
  _.each(fragments, function (fragment, index) {
    fragment.on('readable', setReadable);
github LinkedDataFragments / Client.js / lib / triple-pattern-fragments / FragmentsClient.js View on Github external
function Fragment(fragmentsClient, pattern) {
  if (!(this instanceof Fragment))
    return new Fragment(fragmentsClient);
  BufferedIterator.call(this);

  this._fragmentsClient = fragmentsClient;
  this._pattern = pattern;
}
BufferedIterator.subclass(Fragment);