export interface RequestDbPool { end(): Promise; } interface PoolRequestScope { readonly pools: Map; readonly finalizers: Array<() => void>; leases: number; closing: boolean; closePromise?: Promise; } interface WaitUntilRequest { waitUntil?: (promise: Promise) => void; } export declare function getCurrentRequestDbPoolScope(): PoolRequestScope | undefined; /** * Keeps the request pool that owns a shared initialization promise alive until * its work settles, even if the request stops awaiting it first. */ export declare function retainRequestDbPoolScope(promise: Promise): Promise; export declare function getOrCreateRequestDbPool(key: string, create: () => T): T; export declare function replaceRequestDbPool(key: string, previous: RequestDbPool, next: RequestDbPool): boolean; export declare function getRequestDbPool(key: string): RequestDbPool | undefined; /** * Gives a Cloudflare request its own database pools and keeps them alive while * the handler, a returned response stream, or registered waitUntil work runs. */ export declare function runWithRequestDbPoolScope(enabled: boolean, request: WaitUntilRequest | undefined, fn: () => T | Promise): T | Promise; export {};