UNPKG

@gebrai/gebrai

Version:

Model Context Protocol server for GeoGebra mathematical visualization

78 lines 2.1 kB
/** * Optimized GeoGebra Instance Pool Management * GEB-9: Performance Optimization: Response Time and Resource Management */ import { GeoGebraInstance } from '../geogebra-instance'; import { GeoGebraPoolConfig } from '../../types/geogebra'; export interface PooledInstance { instance: GeoGebraInstance; isActive: boolean; lastUsed: Date; createdAt: Date; usageCount: number; } export declare class OptimizedInstancePool { private static poolInstance; private instances; private config; private cleanupInterval?; private defaultConfig; private constructor(); static getInstance(config?: Partial<GeoGebraPoolConfig>): OptimizedInstancePool; /** * Get an available instance from the pool */ getInstance(): Promise<GeoGebraInstance>; /** * Release an instance back to the pool */ releaseInstance(instance: GeoGebraInstance): Promise<void>; /** * Find an available (non-active) instance */ private findAvailableInstance; /** * Create a new instance and add to pool */ private createNewInstance; /** * Force cleanup of the oldest instance to make room */ private forceCleanupOldest; /** * Remove and cleanup an instance */ private removeInstance; /** * Start automatic cleanup timer */ private startCleanupTimer; /** * Perform periodic cleanup of idle instances */ private performCleanup; /** * Get count of active instances */ private getActiveCount; /** * Get pool statistics */ getStats(): { totalInstances: number; activeInstances: number; averageUsage: number; oldestInstanceAge: number; memoryEstimate: number; }; /** * Cleanup all instances and stop timers */ cleanup(): Promise<void>; /** * Warm up the pool by pre-creating instances */ warmUp(count?: number): Promise<void>; } export declare const optimizedInstancePool: OptimizedInstancePool; //# sourceMappingURL=instance-pool.d.ts.map