balanced-pool.d.ts 1019 B

123456789101112131415161718192021222324252627282930
  1. import Pool from './pool'
  2. import Dispatcher from './dispatcher'
  3. import { URL } from 'node: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. getUpstream (upstream: string | URL): Pool | undefined
  11. upstreams: Array<string>
  12. /** `true` after `pool.close()` has been called. */
  13. closed: boolean
  14. /** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */
  15. destroyed: boolean
  16. // Override dispatcher APIs.
  17. override connect (
  18. options: BalancedPoolConnectOptions
  19. ): Promise<Dispatcher.ConnectData>
  20. override connect (
  21. options: BalancedPoolConnectOptions,
  22. callback: (err: Error | null, data: Dispatcher.ConnectData) => void
  23. ): void
  24. }