UNPKG

uid-pool

Version:

High-performance UUID and unique ID pooling for Node.js. Pre-generate IDs in background worker threads for O(1) synchronous acquisition. Drop-in replacement for uuid.v4() and nanoid() with 10-100x better performance under load.

23 lines 1.25 kB
import { BaseIdPool } from "../core/pool.js"; import type { IdPoolOptions } from "../core/types.js"; /** * Edge runtime implementation of IdPool. * Uses chunked generation on main thread since worker threads are not available. */ export declare class IdPool extends BaseIdPool { private refillTimeout; private pendingRefill; private constructor(); /** * Create a new IdPool instance that is ready for use. */ static create(options: IdPoolOptions): Promise<IdPool>; protected startInternal(): void; protected stopInternal(): Promise<void>; protected triggerRefill(): Promise<void>; private doRefill; private generateInChunks; } export type { IdPoolOptions, PoolStats } from "../core/types.js"; export { IdPoolError, InvalidConfigurationError, InvalidGeneratorError, InvalidPoolSizeError, InvalidMinSizeError, InvalidRefillBatchSizeError, InvalidCapacityError, PoolEmptyError, PoolNotReadyError, PoolStoppedError, PoolTimeoutError, GeneratorFailureError, InvalidGeneratorOutputError, WorkerNotInitializedError, WorkerTimeoutError, WorkerCrashError, WorkerGenerationError, SerializationError, ResourceExhaustionError, InvalidRuntimeError, } from "../core/errors.js"; //# sourceMappingURL=index.d.ts.map