balanced-pool.d.ts 957 B

1234567891011121314151617181920212223242526272829
  1. import Pool from './pool'
  2. import Dispatcher from './dispatcher'
  3. import { URL } from 'url'
  4. export default BalancedPool
  5. type BalancedPoolConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>
  6. declare class BalancedPool extends Dispatcher {
  7. constructor (url: string | string[] | URL | URL[], options?: Pool.Options)
  8. addUpstream (upstream: string | URL): BalancedPool
  9. removeUpstream (upstream: string | URL): BalancedPool
  10. upstreams: Array<string>
  11. /** `true` after `pool.close()` has been called. */
  12. closed: boolean
  13. /** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */
  14. destroyed: boolean
  15. // Override dispatcher APIs.
  16. override connect (
  17. options: BalancedPoolConnectOptions
  18. ): Promise<Dispatcher.ConnectData>
  19. override connect (
  20. options: BalancedPoolConnectOptions,
  21. callback: (err: Error | null, data: Dispatcher.ConnectData) => void
  22. ): void
  23. }