Comparing version 5.5.3 to 5.5.4
@@ -0,1 +1,5 @@ | ||
## 5.5.4 | ||
* Sets an appropriate default highWaterMark on write streams | ||
## 5.4.1 | ||
@@ -2,0 +6,0 @@ |
@@ -0,10 +1,14 @@ | ||
var sm = new (require('sphericalmercator'))(); | ||
var Stats = require('./stream-util').Stats; | ||
var Tile = require('./stream-util').Tile; | ||
var Info = require('./stream-util').Info; | ||
var isEmpty = require('./stream-util').isEmpty; | ||
var multiread = require('./stream-util').multiread; | ||
var setConcurrency = require('./stream-util').setConcurrency; | ||
var stream = require('stream'); | ||
var util = require('util'); | ||
var Parallel = require('parallel-stream'); | ||
var queue = require('queue-async'); | ||
module.exports = List; | ||
util.inherits(List, Parallel); | ||
util.inherits(List, stream.Transform); | ||
@@ -15,2 +19,3 @@ function List(source, options) { | ||
this.buffer = ''; | ||
this.bufferzxy = []; | ||
this.stats = new Stats(); | ||
@@ -20,3 +25,11 @@ this.length = 0; | ||
Parallel.call(this, setConcurrency(), options); | ||
// Determine when the writable stream is finished so the | ||
// readable stream can stop waiting. | ||
this.done = false; | ||
var s = this; | ||
this.on('finish', function() { | ||
s.done = true; | ||
}); | ||
stream.Transform.call(this, {}); | ||
this._writableState.objectMode = false; | ||
@@ -26,5 +39,6 @@ this._readableState.objectMode = true; | ||
List.prototype._preprocess = function(obj, enc) { | ||
List.prototype._transform = function(obj, encoding, callback) { | ||
this.buffer += obj.toString('utf8'); | ||
var list = this; | ||
var stream = this; | ||
@@ -39,3 +53,3 @@ function pushTile(str) { | ||
list.concurrentBuffer.push({z:z,x:x,y:y}); | ||
list.bufferzxy.push({z:z,x:x,y:y}); | ||
list.stats.total++; | ||
@@ -59,32 +73,37 @@ list.length++; | ||
this.emit('length', this.length); | ||
}; | ||
List.prototype._process = function(zxy, encoding, callback) { | ||
var list = this; | ||
if (!this.bufferzxy.length) return callback(); | ||
list.stats.ops++; | ||
var q = queue(setConcurrency()); | ||
while (this.bufferzxy.length) q.defer(toTile, this.bufferzxy.shift()); | ||
q.awaitAll(function(err) { callback(err); }); | ||
if (list.job && zxy.x % list.job.total !== list.job.num) | ||
return skip(); | ||
function toTile(zxy, done) { | ||
stream.stats.ops++; | ||
list.source.getTile(zxy.z, zxy.x, zxy.y, function(err, buffer) { | ||
if (err && !(/does not exist$/).test(err.message)) { | ||
callback(err); | ||
} else if (err || isEmpty(buffer)) { | ||
skip(); | ||
} else { | ||
list.stats.done++; | ||
list.push(new Tile(zxy.z, zxy.x, zxy.y, buffer)); | ||
callback(); | ||
if (stream.job && zxy.x % stream.job.total !== stream.job.num) | ||
return skip(); | ||
stream.source.getTile(zxy.z, zxy.x, zxy.y, function(err, buffer) { | ||
if (err && !(/does not exist$/).test(err.message)) { | ||
done(err); | ||
} else if (err || isEmpty(buffer)) { | ||
skip(); | ||
} else { | ||
stream.stats.done++; | ||
stream.push(new Tile(zxy.z, zxy.x, zxy.y, buffer)); | ||
done(); | ||
} | ||
}); | ||
function skip() { | ||
stream.stats.skipped++; | ||
stream.stats.done++; | ||
// Update length | ||
stream.length--; | ||
stream.emit('length', stream.length); | ||
done(); | ||
} | ||
}); | ||
function skip() { | ||
list.stats.skipped++; | ||
list.stats.done++; | ||
// Update length | ||
list.length--; | ||
list.emit('length', list.length); | ||
callback(); | ||
} | ||
}; | ||
{ | ||
"name": "tilelive", | ||
"version": "5.5.3", | ||
"version": "5.5.4", | ||
"main": "./lib/tilelive.js", | ||
@@ -35,6 +35,5 @@ "description": "API for various map tile backends", | ||
"minimist": "~0.2.0", | ||
"parallel-stream": "0.1.4", | ||
"progress-stream": "~0.5.x", | ||
"queue-async": "~1.0.7", | ||
"sphericalmercator": "~1.0.1" | ||
"sphericalmercator": "~1.0.1", | ||
"queue-async": "~1.0.7" | ||
}, | ||
@@ -41,0 +40,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59334
4
1053
- Removedparallel-stream@0.1.4
- Removedbasic-queue@1.0.1(transitive)
- Removedparallel-stream@0.1.4(transitive)