Files
SnowLuma/.pnpm-store/v11/files/d5/063cb0ba27eb33b015e153b96e911d38f70a8b075c296ed9374fd1c9177d3d15d6b067a0080567a7a8b216a713e9c78581b1ed3bf929755bf02728b3bb6bd0
TanTan 2a69b23b47
Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Skipped
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

42 lines
1.5 KiB
Plaintext

import Client from './client'
import TPoolStats from './pool-stats'
import { URL } from 'node:url'
import Dispatcher from './dispatcher'
export default Pool
type PoolConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>
declare class Pool extends Dispatcher {
constructor (url: string | URL, options?: Pool.Options)
/** `true` after `pool.close()` has been called. */
closed: boolean
/** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */
destroyed: boolean
/** Aggregate stats for a Pool. */
readonly stats: TPoolStats
// Override dispatcher APIs.
override connect (
options: PoolConnectOptions
): Promise<Dispatcher.ConnectData>
override connect (
options: PoolConnectOptions,
callback: (err: Error | null, data: Dispatcher.ConnectData) => void
): void
}
declare namespace Pool {
export type PoolStats = TPoolStats
export interface Options extends Client.Options {
/** Default: `(origin, opts) => new Client(origin, opts)`. */
factory?(origin: URL, opts: object): Dispatcher;
/** The max number of clients to create. `null` if no limit. Default `null`. */
connections?: number | null;
/** The amount of time before a client is removed from the pool and closed. `null` if no time limit. Default `null` */
clientTtl?: number | null;
interceptors?: { Pool?: readonly Dispatcher.DispatchInterceptor[] } & Client.Options['interceptors']
}
}