cluster.js 1.4 KB

1234567891011121314151617181920
  1. var cluster = require("cluster");
  2. var promisify = require("./_promisify.js");
  3. var bind = function(c, f) { return f && f.bind(c); };
  4. Object.defineProperties(module.exports, {
  5. SCHED_NONE: { enumerable: true, value: cluster.SCHED_NONE },
  6. SCHED_RR: { enumerable: true, value: cluster.SCHED_RR },
  7. Worker: { enumerable: true, value: cluster.Worker },
  8. //_events: // skipping
  9. //_eventsCount: // skipping
  10. //_maxListeners: // skipping
  11. disconnect: { enumerable: true, value: promisify(cluster, cluster.disconnect, 0) },
  12. domain: { enumerable: true, get: function() { return cluster.domain; }, set: function(v) { cluster.domain = v; } },
  13. fork: { enumerable: true, value: bind(cluster, cluster.fork) },
  14. isMaster: { enumerable: true, get: function() { return cluster.isMaster; }, set: function(v) { cluster.isMaster = v; } },
  15. isWorker: { enumerable: true, get: function() { return cluster.isWorker; }, set: function(v) { cluster.isWorker = v; } },
  16. schedulingPolicy: { enumerable: true, get: function() { return cluster.schedulingPolicy; }, set: function(v) { cluster.schedulingPolicy = v; } },
  17. settings: { enumerable: true, get: function() { return cluster.settings; }, set: function(v) { cluster.settings = v; } },
  18. setupMaster: { enumerable: true, value: bind(cluster, cluster.setupMaster) },
  19. workers: { enumerable: true, get: function() { return cluster.workers; }, set: function(v) { cluster.workers = v; } },
  20. });