Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Teow Hua Jun authored and Teow Hua Jun committed Jul 1, 2022
1 parent 0a5ef1d commit 99a2eb5
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,45 @@
import { EventEmitter } from "events";

export class Pool<T> extends EventEmitter {
spareResourceCapacity: number;
size: number;
available: number;
borrowed: number;
pending: number;
max: number;
min: number;
spareResourceCapacity: number;
size: number;
available: number;
borrowed: number;
pending: number;
max: number;
min: number;

start(): void;
acquire(priority?: number): Promise<T>;
release(resource: T): Promise<void>;
destroy(resource: T): Promise<void>;
drain(): Promise<void>;
clear(): Promise<void>;
use<U>(cb: (resource: T) => U | Promise<U>): Promise<U>;
isBorrowedResource(resource: T): boolean;
ready(): Promise<void>;
start(): void;
acquire(priority?: number): Promise<T>;
release(resource: T): Promise<void>;
destroy(resource: T): Promise<void>;
drain(): Promise<void>;
clear(): Promise<void>;
use<U>(cb: (resource: T) => U | Promise<U>): Promise<U>;
isBorrowedResource(resource: T): boolean;
ready(): Promise<void>;
}

export interface Factory<T> {
create(): Promise<T>;
destroy(client: T): Promise<void>;
validate?(client: T): Promise<boolean>;
create(): Promise<T>;
destroy(client: T): Promise<void>;
validate?(client: T): Promise<boolean>;
}

export interface Options {
max?: number;
min?: number;
maxWaitingClients?: number;
testOnBorrow?: boolean;
testOnReturn?: boolean;
acquireTimeoutMillis?: number;
fifo?: boolean;
priorityRange?: number;
autostart?: boolean;
evictionRunIntervalMillis?: number;
numTestsPerEvictionRun?: number;
softIdleTimeoutMillis?: number;
idleTimeoutMillis?: number;
max?: number;
min?: number;
maxWaitingClients?: number;
testOnBorrow?: boolean;
testOnReturn?: boolean;
acquireTimeoutMillis?: number;
fifo?: boolean;
priorityRange?: number;
autostart?: boolean;
evictionRunIntervalMillis?: number;
numTestsPerEvictionRun?: number;
softIdleTimeoutMillis?: number;
idleTimeoutMillis?: number;
}

export function createPool<T>(factory: Factory<T>, opts?: Options): Pool<T>;
export function createPool<T>(factory: Factory<T>, opts?: Options): Pool<T>;

0 comments on commit 99a2eb5

Please sign in to comment.