pool-stats.js 552 B

12345678910111213141516171819202122232425262728293031323334
  1. const { kFree, kConnected, kPending, kQueued, kRunning, kSize } = require('./core/symbols')
  2. const kPool = Symbol('pool')
  3. class PoolStats {
  4. constructor (pool) {
  5. this[kPool] = pool
  6. }
  7. get connected () {
  8. return this[kPool][kConnected]
  9. }
  10. get free () {
  11. return this[kPool][kFree]
  12. }
  13. get pending () {
  14. return this[kPool][kPending]
  15. }
  16. get queued () {
  17. return this[kPool][kQueued]
  18. }
  19. get running () {
  20. return this[kPool][kRunning]
  21. }
  22. get size () {
  23. return this[kPool][kSize]
  24. }
  25. }
  26. module.exports = PoolStats