CartoDB-SQL-API/batch/job_queue_pool.js
2015-12-29 10:19:10 +01:00

31 lines
635 B
JavaScript

'use strict';
var JobQueue = require('./job_queue');
function JobQueuePool(metadataBackend) {
this.metadataBackend = metadataBackend;
this.queues = {};
}
JobQueuePool.prototype.get = function (host) {
return this.queues[host];
};
JobQueuePool.prototype.tap = function (host) {
};
JobQueuePool.prototype.list = function () {
return Object.keys(this.queues);
};
JobQueuePool.prototype.add = function (host) {
this.queues[host] = new JobQueue(this.metadataBackend);
return this.get(host);
};
JobQueuePool.prototype.remove = function (host) {
delete this.queues[host];
};
module.exports = JobQueuePool;