import { NodeSnowflakePool } from './node-snowflake-pool'; import { IConnectionPoolConfig, IConnectionPool, IConnectionInfo, IConnectionConfig } from './interfaces'; /** * Node Snowflake connection Mananger pool * @unstable * @WIP * @notes Don't used this */ export class NodeSnowflakePoolManager { public activeConnectionPool: NodeSnowflakePool; public killingConnectionPool: NodeSnowflakePool; public async reInitiateConnectionPoolWithBlueGreen( connectionConfigArray: Array ): Promise { const newConnectionPool = new NodeSnowflakePool(); this.killingConnectionPool = this.activeConnectionPool; await newConnectionPool.createConnectionPool(connectionConfigArray); this.activeConnectionPool = newConnectionPool; await this.killingConnectionPool.killAllConnection(); return this.getCompleteConnectionPool(); } public async initiateConnectionPool(connectionConfigArray: Array): Promise { const newConnectionPool = new NodeSnowflakePool(); await newConnectionPool.createConnectionPool(connectionConfigArray); this.activeConnectionPool = newConnectionPool; return this.getCompleteConnectionPool(); } public getConnection(id: string): any { return this.activeConnectionPool.getConnection(id); } public getConnectionObject(id: string): IConnectionPool { return this.activeConnectionPool.getConnectionObject(id); } public getCompleteConnectionPool(): Array { return this.activeConnectionPool.getCompleteConnectionPool(); } }