CartoDB-SQL-API/batch/job_queue_pool.js
2015-12-29 15:46:04 +01:00

28 lines
584 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.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;